I am sending some parameters using XMLHttpRequest. The problem is that one of the parameters comes with many '&' inside and I dont know which one. For example title="abc&foo=324243..." so I dont recieve it completely in php.
var params = 'id='+mediaPath
+'&title='+title
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
}
}
xhr.onerror = function(e) {
console.log(jqXHR, textStatus, errorThrown);
};
xhr.open('POST', url);
xhr.setRequestHeader("Content-Type", 'application/x-www-form-urlencoded');
xhr.send(params);
I tried like this, but again params are not recieved in php at all:
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
}
}
xhr.onerror = function(e) {
console.log(jqXHR, textStatus, errorThrown);
};
xhr.open('POST', url);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify({ id: mediaPath, title: title });