How To Pass Back An Object From An Ajax Success Handler To The Calling Function?
I'm trying to pass back the results of an Ajax request to the triggering function. But my response is 'lost on the way'... This is what I'm doing: some = function (){ // insi
Solution 1:
Since your ajax call is asynchronous, the execution of the getItems
function will be finished long before you get your data back. One thing you could do is add a callback argument to the call, and call it when your ajax succeeds. Something like:
getItems: function(cbk)
//(...)
successHandler = function(objResponse) {
// here is the objResponse I need to pass backcbk(ojbResponse);
};
but then, you have to change your dynoData
call to getItems
to add the callback, that will finish the new object's setup.
Another solution would be to make the ajax call synchronous, but this halts your browser until you get your data back, which makes the system unresponsive.
Post a Comment for "How To Pass Back An Object From An Ajax Success Handler To The Calling Function?"