jquery - How to pass huge data through ajax call using XmlHttpRequest -
i need pass huge data controller. have used xmlhttprequest
. have written code like:
var xmlhttp; if (window.xmlhttprequest) { xmlhttp = new xmlhttprequest(); } else { xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("mydiv").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("post", "/home/content", true); xmlhttp.send("content=" + data);
and actionresult
like
[httppost] public actionresult(string content) { return json("suc", jsonrequestbehavior.allowget); }
the data like
uklgripkaabxrujqvla4[...huge piece of data...]kxgtrtkkyke6xap+gyny93kj
but not passing controller. showing data long. how can rid of this?
send data in post body, passing argument send
:
xmlhttp.open("post", "/home/content", true); xmlhttp.send("content=" + data);
then, on server, read content
parameter of post data.
Comments
Post a Comment