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!!!
Link to comment
Share on other sites

[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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.