Created
November 2, 2012 19:33
-
-
Save jmather/4003823 to your computer and use it in GitHub Desktop.
random-guess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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