Des429 Posted April 15, 2010 Share Posted April 15, 2010 Whats the best/most used way to create multiple AJAX connections rather than copy/paste/rename all the functions each time i want to make a new ajax function? i know theres gotta be an easier way... Link to comment Share on other sites More sharing options...
0 Hot Posted April 17, 2010 Share Posted April 17, 2010 Just make one Ajax function that takes a URL to send the information to, a set of parameters to send, and a function to run when the request is complete. Inside the function you would have all the redundant bits, such as creating an XMLHttpRequest object and sending the information. Or you could use a library like jQuery, which already has what I just recommended built in. Josh 1 Share Link to comment Share on other sites More sharing options...
0 nvme Posted April 18, 2010 Share Posted April 18, 2010 +1 for jquery Link to comment Share on other sites More sharing options...
0 Tanoru Posted April 18, 2010 Share Posted April 18, 2010 +1 for jquery +2 Link to comment Share on other sites More sharing options...
0 sweetsam Posted April 22, 2010 Share Posted April 22, 2010 +2 +3 Link to comment Share on other sites More sharing options...
0 RoomKid Posted April 22, 2010 Share Posted April 22, 2010 +3 +4 Link to comment Share on other sites More sharing options...
0 kyosuken Posted April 22, 2010 Share Posted April 22, 2010 +5 Besides if you want to make more than 2 ajax connections at a time you would need to make your ajax function an object. But Jquery is so easy to use it's a no brainer. Link to comment Share on other sites More sharing options...
Question
Des429
Whats the best/most used way to create multiple AJAX connections rather than copy/paste/rename all the functions each time i want to make a new ajax function? i know theres gotta be an easier way...
Link to comment
Share on other sites
6 answers to this question
Recommended Posts