I want to use a simple ajax function in Laravel, I am familiar with jQuery ajax and I read in docs metronic8 does not use jQuery. I want to know, is it okay to include jQuery or metronic8 have anything to perform Ajax?
You're welcome! Don't hesitate to reach out if you have any further questions or concerns.
Hi Mamta,
The best way to use Ajax in Laravel is by using the Axios library, which is already included in the Laravel package.json file and starterkit/resources/mix/plugins.js. Here's a sample code that you can use:
axios.post("/api/endpoint", {
data: "some data"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Thank you for your reply.