Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] IE, Firefox, and XMLHTTPRequest


  • From: matt.murphy at thermofisher.com (Matt Murphy)
  • Subject: [Javascript] IE, Firefox, and XMLHTTPRequest
  • Date: Fri Dec 29 13:12:58 2006

So, I'm a bit of a javascript n00b. I've got a script that uses
XMLHTTPRequest, though that part I did not write. (contributed with
permission) The firefox version works fine with the sample data I'm
using, but the IE version fails if the input string is too long. 
 
here is the XMLHTTPRequest part: 
 
function ajaxme(url)
{
 
        http_request = false;
 
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new
ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
 
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance. Your
browser may be too old for this application.');
            return false;
        }
        http_request.onreadystatechange = hitMe;
        http_request.open('POST', url, true);
        http_request.send(null);
    }
 
and this is how I call it in my page:
 
ajaxme('notes.php?action=insnotedb&table='+tablename+'&note='+note+'&con
n='+conn+'&datefield='+datefield+'&connid='+connid+'&data='+escape(data)
);
 
if data is long, IE barfs on this line:
        http_request.open('POST', url, true);
but firefox is fine with long data. 
 
For short stuff (5 paragraphs?) they're both fine.
 
Using a form to POST the same data (4x longer than is barfed on by IE)
works in both browsers. 
 
Is there a limitation to the size of http request IE will accept with
XMLHTTP? Any idea what's going on? 
 
Thanks,
 
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.LaTech.edu/pipermail/javascript/attachments/20061229/6f2de122/attachment.html