Hi all,
Is there a way to pass more data into a callback function in Jquery?
I have two functionsm and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as well as a few custom arguments
function clicked() {
var myDiv = $("#my-div");
// ERROR: Says data not defined
$.post("someurl.php",someData,doSomething(data, myDiv),"json");
// ERROR: Would pass in myDiv as curData (wrong)
$.post("someurl.php",someData,doSomething(data, myDiv),"json");
}
function doSomething(curData, curDiv) {
}
Sorry if this is hard to understand. Basically I just want to be able to pass in my own parameters to a callback, as well as the result returned from the AJAX call.
Thanks!