Skip to content

Instantly share code, notes, and snippets.

@jmather
Created November 2, 2012 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmather/4003823 to your computer and use it in GitHub Desktop.
Save jmather/4003823 to your computer and use it in GitHub Desktop.
random-guess
// here is how I suspect you are currently doing something.
// Assuming you have a piece of data you need to send back with your request processing:
function sendMyRequest(info)
{
var response_callback = function(data) {
callMyActualReturnMethod(data, info);
}
$.get('/some/path', response_callback, 'json');
}
// here is how this should be done to avoid issues
function sendMyRequest(info)
{
var response_callback = function(info) {
return function(data) {
callMyActualReturnMethod(data, info);
}
}
$.get('/some/path', response_callback(info), 'json');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment