Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2 urls in one ajax call?

I was wondering if I can do this jquery ajax on my code:

$.ajax({
  type: "POST",
  dataType: 'json',
  url: "functions/ajaxNca_add.php", "functions/ajaxNca_update.php",
  data: dataString,
  cache: false,
  success: function(response){
    // show success
    alert(response.a);
}

The code above is just an example and I knew that it's not working. How can I call 2 php script in just one ajax request in jquery ? Can someone help ?

like image 668
Larcy Avatar asked Sep 04 '25 01:09

Larcy


1 Answers

No you can not do this. If you will look at jquery ajax documentation, you will see that url accepts only string, not an array of stings.

You should either make two requests, or create another *.php entry point which will combine both php scripts and make a call to this one.

like image 177
Salvador Dali Avatar answered Sep 06 '25 16:09

Salvador Dali