?
Solved

javascript ajax reuse

Posted on 2011-10-11
2
Medium Priority
?
144 Views
Last Modified: 2012-05-12
hi

wat i am trying is to get back data from ajax function to the calling function (end do sumthing whit the data)

function 1(){

......
 for(i, i<x; i++){
     if (ajaxFunction(userId)==0){ // call to ajax function
        do that;
    }
  else{
     do else
   }

 }
}


how it can be don?

thanks

0
Comment
Question by:yairab
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 1000 total points
ID: 36950585
0
 

Assisted Solution

by:kclougherty
kclougherty earned 1000 total points
ID: 36954799
The preferred method is to use a callback function.  Using synchronous calls means the call will block until the AJAX call returns.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question