How to call more than one url from one button in jQuery ajax? -


is possible call 2 urls through button in jquery. example, want add commented 1 well. how shall represent them?

$.ajax({         //    url: 'ajax/releasebackend.php',             url: 'batch/2-release-tmp.php',             type: 'post',             async: false,             data: {"fid":"abc"},             datatype: 'xml',             error: function(){                 alert('error loading xml document');             },             success: function(data){                         //check error                 alert("success");                 var $error=$(data).find('error').text();                 if($error!="0")                 {                     messagebox("error",$error);                     return;                 }              }         }); 

you can't make ajax request 2 urls simultaneously/in same call, you'll need call them separately 2 different $.ajax() calls.

you make function example:

function doajax(url) {   $.ajax({       url: url,       type: 'post',       async: false,       data: {"fid":"abc"},       datatype: 'xml',       error: function(){           alert('error loading xml document');       },       success: function(data){                   //check error           alert("success");           var $error=$(data).find('error').text();           if($error!="0")           {               messagebox("error",$error);           }       }   }); } doajax('ajax/releasebackend.php'); doajax('batch/2-release-tmp.php'); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -