Note that there are some explanatory texts on larger screens.

plurals
  1. POMax length of send() data param on XMLHttpRequest Post
    primarykey
    data
    text
    <p>Is there a documented max to the length of the string data you can use in the send method of an XMLHttpRequest for the major browser implementations?</p> <p>I am running into an issue with a JavaScript XMLHttpRequest Post failing in FireFox 3 when the data is over approx 3k. I was assuming the Post would behave the same as a conventional Form Post.</p> <p>The W3C docs mention the data param of the send method is a DOMString but I am not sure how the major browsers implement that.</p> <p>Here is a simplified version of my JavaScript, if bigText is over about 3k it fails, otherwise it works...</p> <pre><code>var xhReq = createXMLHttpRequest(); function createXMLHttpRequest() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} try { return new XMLHttpRequest(); } catch(e) {} alert("XMLHttpRequest not supported"); return null; } function mySubmit(id, bigText) { var url = "SubmitPost.cfm"; var params = "id=" + id + "&amp;bigtext=" + encodeURI(bigText); xhReq.open("POST", url, true); //Send the header information along with the request xhReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhReq.setRequestHeader("Content-length", params.length); xhReq.setRequestHeader("Connection", "close"); xhReq.onreadystatechange = onPostSubmit; xhReq.send(params); } function onPostSubmit() { if (xhReq.readyState==4 || xhReq.readyState=="complete") { if (xhReq.status != 200) { alert('BadStatus'); return; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload