With jQuery $ .post, can I return data to an array or return 2 data sets?
Example:
$.post("MyScript.php", { action:"run" },function(data){
alert(data);
});
Now this simple post above sends an action to a php script that performs 2 functions and returns data, which is then displayed in a warning window. But my PHP script has 2 functions and should do different things with each of the returned data.
So, essentially, I am asking if $ .post can return 2 datasets, for example:
$.post("MyScript.php", { action:"run" },function(data1, data2){
alert(data1);
$("div1").html(data2);
});
or can the return data be an array, where can I assign values to the elements of the array in a php script?
I hope this makes sense.
source
share