I need to use an external function for my success callback and I don't know how to pass the json object to my function.
$.ajax({
url:"get_box.php",
type:"POST",
data:data,
dataType:"json",
success: myFunction(data);
});
And my function looks this way:
function myFunction(result2){
...
}
The error is: undefined result2...
How about you implement both success and fail-callback methods (jquery documentation). You can also chain these instead of providing them in the initial ajax settings-object like so:
Here is a fiddle
Try this way,
or ...