Saturday, December 15, 2007

XmlHttpRequest script 2.0

Quite a while ago, I told you about this script that I had written, which would make xmlHttpRequests for me. Now I have made a version 2.0, I ramp up all the way to the next major version umber. Why? Because there are considerable changes, including ones in syntax.
I changed the name of my function, added an argument (called args for irony's sake). Besides that the script now supports POST calls besides the regular GET calls. Also, it no longer ought to make any kind of complain when new requests are made before the first one is finished.
The script is available from here, but there are some things I really want to say. For my bandwidth (even though it won't matter much) and your security, do not include the script right from my website. Instead, download it, and put it with your website on a host and then include it using a script tag. And to make sure I won't mistake you for a "includer" do not link directly to the file, link to this post instead.
If you stick to these few rules you can use my script. A guide is to be found within the file (all commented out of course) - using the script shouldn't be too hard. Good luck with your web designing.


  • changed the name of main function from send to request
  • added an argument to request in preparation for POST support
  • changed GET cases to work with new args argument
  • added POST support
  • made XMLHttpRequest variable local - solving problems with multiple calls after eachother
  • renamed the XMLHttpRequest variable from submitting to XHRequest
  • removed time-out as changes should have taken away any reason for it
  • deleted highPrioritySend function, as it would do nothing now
  • removed global variables busy and time_out that were related to time outs
  • made receive an inline, unnamed function inside request - allowing easier variable names
  • removed global variable next_function, as this allowed todo to be used directly (woot, no global variables anymore)

No comments: