www.webdeveloper.com
Results 1 to 12 of 12

Thread: [RESOLVED] xmlHttpCreate function ie6 FAIL!

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    17

    resolved [RESOLVED] xmlHttpCreate function ie6 FAIL!

    I'm trying to GET or POST a request to a server. The code below works fine in Firefox, Safari, Chrome and IE7+ but fails in IE6 in spite of the xmlHttpCreate function being copied and pasted straight from Microsoft's MSDN site. The place where IE6 fails is on the oReq.send() line. It appears to create an activeX object but just won't send it. I have also tried oReq.send(null) and oReq.send("") but neither works.


    function _call(url){

    oReq = xmlHttpCreate();
    if (oReq != null) {
    //oReq.open("GET", url, false);
    oReq.open("POST", url, false);
    oReq.send(); // <=============== this is where IE6 fails
    return oReq.responseText;
    }
    else {
    alert("AJAX (XMLHTTP) not supported.");
    }


    }

    function xmlHttpCreate(){
    if (window.XMLHttpRequest) {
    return new window.XMLHttpRequest;
    }
    else {
    try {
    return new ActiveXObject("MSXML2.XMLHTTP.3.0");
    }
    catch(ex) {
    return null;
    }
    }

    }

    Any help with this would be greatly appreciated.

  2. #2
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Error message?

    Did you use a tool such as Fiddler to see if a request goes out?

    Eric

  3. #3
    Join Date
    Apr 2009
    Posts
    17
    Quote Originally Posted by A1ien51 View Post
    Error message?

    Did you use a tool such as Fiddler to see if a request goes out?

    Eric
    Thanks for looking at this for us :-)

    Just tested with Fiddler:

    Fiddler shows that the request did not go out.

    We are really greatful for any ideas or help you can give :-)

  4. #4
    Join Date
    Apr 2009
    Posts
    17
    Ohhh...by the way:

    the error in IE6 is just "unspecified error" on line 57 char 4 which is the "oReq.send()" line.

    We should have also given you a link to our test page:
    http://www.kentculturalbaton.com/art...hitstable.html

    Check in all GOOD browsers it's perfect then ie6 (client handcuffs) it just doesn't work.

  5. #5
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Try using

    Code:
    return new ActiveXObject("Msxml2.XMLHTTP");
    See if that makes any difference.

    Eric

  6. #6
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    You are getting http status code of 122

    http://www.codebelay.com/blog/2008/0...-in-ajax-apps/

    Eric

  7. #7
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    You do not have to make an Ajax call to Flickr. You can do a JSONP call using the jsoncallback.

    Eric

  8. #8
    Join Date
    Jun 2007
    Posts
    667
    If you use POST then try passing the url as a parameter to send(), and call
    Code:
    httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    before send().

  9. #9
    Join Date
    Apr 2009
    Posts
    17
    OK, so first and foremost - MASSIVELY greatful to you for your replies :-)

    Now in responce to all of the above -

    I've tried
    return new ActiveXObject("Msxml2.XMLHTTP");
    but decided to go with the Microsoft recommendation of
    return new ActiveXObject("MSXML2.XMLHTTP.3.0");
    (see http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx )
    neither makes any difference

    in reply to "You are getting http status code of 122"
    I've tried both POST and GET. Both work in IE7+ and Firefox but neither work in IE6

    in reply to "You can do a JSONP call using the jsoncallback"
    I'm not using jQuery.
    Our ajax call is made to a php script on our server. The php script makes the call to Flickr and returns the result to the javascript.
    Since we are using Mootools to do the slideshow I'll investigate whether it has a similar function to JSONcallback in jQuery

    THANKS AGAIN :-)

  10. #10
    Join Date
    Apr 2009
    Posts
    17
    SOLVED!!!! The URL being passed to the Request object was too Long!!!! :-)

  11. #11
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Quote Originally Posted by MadManMcCann View Post
    SOLVED!!!! The URL being passed to the Request object was too Long!!!! :-)
    I am guessing you did not read that URL I posted that said it was a URL that was too long. lol

    Eric

  12. #12
    Join Date
    Apr 2009
    Posts
    17
    Sorry mate - was that in the link to codebelay?
    All credit to you though for pointing that out :-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles