get the response of a jquery ajax call as an input parameter of another function:
Posted
by
Nauman Bashir
on Stack Overflow
See other posts from Stack Overflow
or by Nauman Bashir
Published on 2011-02-03T23:15:33Z
Indexed on
2011/02/03
23:26 UTC
Read the original article
Hit count: 450
Hello, Is it possible to make a jquery ajax call, and get the response as an input parameter of another function:
here is an example, i have the following function call at a location:
updateTips(validationTextObject,objUsers.fetchAvailable());
the objUsers.fetchAvailable() function makes a ajax call to the server. The callback function on successful call would be something like this. It is being used to process the result
BHUsers.prototype.recvAvailable= function(response){
// some kind of processing over here
return (response["status"] == "OK")? "Available" : "Not Available";
}
I want that fuction to return the processed result which can be used as a parameter to the function updateTips
The primary goal of this is to be able to do all of this for multiple scenarios, rather than writing multiple functions for the same call. Also i want the calling and the response processing functions to just do what they are doing. I dont want to add html objects into it.
Any Clues?
© Stack Overflow or respective owner