1164 1 0 0
Last Updated : 2025-04-28 20:29:02
If you need to call a resource on the server using the jquery ajax technique, here is an example
var theForm = $("#activeTagsForm") ;
var formAction = theForm[0].action;
var formMethod = theForm[0].method;
var formData = theForm.serialize();
//console.log(formData);
var theAction = "{{ URL('activetags') }}" ;
$.ajax({
type: "post",
//activetags.blade.phpurl: theAction+'?'+'&searchWord='+searchWord+"&page="+url2,
url: theAction+'?'+"&page="+url2,
data:formData,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
dataType: "json",
success: function (msg) {//alert('Success');
if (msg) {
if(msg['myResponseStatus'])
{
$("#allResults").html(msg['myResponseData']);
}
else
{
//The process has failed on srerver
alert('Nooo');
}
} else {
alert('There is NO message');
}
},
}).done(function (data) {//alert('donee');
}).fail(function () {alert('Failure');
alert('Failed to load.');
});?
Read Also