Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLHttpRequest Object

Status
Not open for further replies.

yngjzy12

Programmer
Dec 29, 2007
28
US
Hey everyone, I'm new to this forum but hopefully someone can help out. My questions concerns the XMLHttpRequest object. I'm creating a web app that is suppose to emulate a MS Access database. The idea is to automatically update input text boxes when the user changes their value, among other things. At this point, I'm creating a new XMLHttpRequest object each time the onblur method is called on a textbox and sending the info to a php page and updating it accordingly. My question is will creating a new XMLHttpRequest object each time cause problems within the Javascript or browser? Also, it seems if I just create one instance of the XMLHttpRequest object and try to re-use it, in IE things don't work. Any ideas on why this happens? I hope this is a clear explanation, and thanks for any help.
 
My question is will creating a new XMLHttpRequest object each time cause problems within the Javascript or browser?

Creating a lot of them in a short space of time can cause a bit of a slow down, but so can creating a whole bunch of strings. Creating a new XMLHttpRequest every time a user selects an option in a couple of comboboxes shouldn't pose a problem on any modern computer.

Also, it seems if I just create one instance of the XMLHttpRequest object and try to re-use it, in IE things don't work. Any ideas on why this happens?
My thoughts would be that you're having one bit of code modify a global variable while another bit of code hasn't finished with it yet. Either that or you've got scope issues.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Enable Apps
 
Thanks for the reply. I actually came up with an article with an explanation of the issue I was referring to with IE not being able to re-use an XMLHttpRequest Object. It turns out that you need to call the open method before you assign the onreadystate callback handler. The article is here:
Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top