ajax simple example
Example 1: ajax exmaple\
$.ajax({
url:'your url',
type: 'POST',
data: { myData: 'This is my data.' },
success: function (data, status, xhr) {
$('p').append('status: ' + status + ', data: ' + data);
},
error: function (jqXhr, textStatus, errorMessage) {
$('p').append('Error' + errorMessage);
}
});
Example 2: ajax example
$.ajax({
method: "POST",
url: "/controller/action",
data: { name: "John", location: "Boston" },
success: (result) => {
console.log(result);
},
error: (error) => {
console.log(error);
}
});