function saveProjectAjax(docsId, content) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
localStorage.setItem('upadateContent',JSON.stringify(content));
if (this.readyState == 4 && this.status == 200) {
}
};
xmlhttp.open("GET", "addProjectDetailBase.php?cu=true&pid=" + docsId+"&content="+encodeURIComponent(content), true);
xmlhttp.send();
}
I want send my content (json) data from function which is large as of 250 kb through content parameter of my function
I agree with what @Magnus Eriksson said above. I will use POST instead of GET. Then I would use a key | value paired object and convert into a JSON string and send over to the server via 'POST'.
Here is an example below,
var xhr = new XMLHttpRequest();
var url = 'addProjectDetailBase.php'
xhr.open("POST", url, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({
value: value
}));
Hope this helps,
Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With