How to include two URL in json ajax -
currently, searchform hit, form submitted. fetch data specified url search/ajax2.php , return data here.
all want add is, include url beside above mentioned one, 2 actions can performed @ same time.
now, in search/ajax2.php runs select query. whereas in additional page want include, writedb.php inserts data taken jason database. doesn't have return ajax page though!
how achieve this?
$("#searchform").on("submit", function () { //$(this).find(':submit').attr('disabled','disabled'); var data = { "action": "test" }; data = $(this).serialize() + "&" + $.param(data); $.ajax({ type: "post", datatype: "json", url: "search/ajax2.php", data: data, success: function (data) { } });
try adding second url in sucess function :
$.ajax({ type: 'post', url: 'some_url1', data: 'some data', success: function(data){ $.ajax ({ type: 'post', url: 'some_url2', data: 'some data', success: function(data){} }); } });
Comments
Post a Comment