Can I send my data to multiple pages using ajax call? I dont want to use another ajax call for this.
Sample code:
$.ajax({
type: \'POST\',
All you need is $.each and the two parameter form of $.ajax
var urls = ['/url/one','/url/two', ....];
$.each(urls, function(i,u){
$.ajax(u,
{ type: 'POST',
data: {
answer_service: answer,
expertise_service: expertise,
email_service: email,
},
success: function (data) {
$(".error_msg").text(data);
}
}
);
});
Note: The messages generated by the success callback will overwrite each other as shown. You'll probably want to use $('#someDiv').append() or similar in the success function.