• 0

Best way to make multiple AJAX connections?


Question

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

  • 0

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.

Link to comment
Share on other sites

  • 0

+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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.