Jump to content

error in IE when using POST method in AJAX script


micah1701

Recommended Posts

In the past I've used AJAX quite a bit to send and receive data. Mostly, I'm sending small bits of data using the GET method (?GET=adding_the_variables_to_the_url).

I'm trying something new and want to send an entire form full of data, so I decided to use the POST method instead.  I thought I had it working, as I have been using it for a couple days now in FireFox, however, I just realized it doesn't work in Internet Explorer.

It returns the error "object doesn't support this property or method" for the line:
[code]http.open("POST", "entryFormsubmit.php", true); [/code]

Again, it works in FF and doesn't throw any erros in the Fire Fox JavaScript console.
any idea what I'm missing?
Let me know if you need to see more code.

FYI...

the http object (referrenced above that "doesn't support the property or method" is built like this:
[code]function getHTTPObject()
{
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5) try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e)
  { try
  { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (E)
  { xmlhttp = false; }
  }
  @else xmlhttp = false; @end
  @*/
 
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
  { try {
  xmlhttp = new XMLHttpRequest(); }
  catch (e)
  { xmlhttp = false; }
  }
  return xmlhttp;

} //end getHTTPObject() function to create XMLHttpRequest Object

var http = getHTTPObject();
[/code]

Thanks!!!
[quote]try taking ", true" out and see what happens[/quote]

That solved it! thanks. 

I always thought the "true" was necessary though, so the script knew to wait for the readyState to change.  But it works fine w/o it.  eh, what do I know. Thats what I get for learning everything through online tutorials.

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.