I am sending a custom XML data from jQuery to Drupal/PHP as follows:
$.ajax({
type: 'POST',
url: this.href,
success: function(data){
alert('Form is successfully saved');
},
error:function(XMLHttpRequest, textStatus, errorThrown){
alert("Error");
},
data: 'myxml='+ mydata
});
My XML tags contains URLs, so I encode them, and before making an AJAX call, data looks somewhat like this:
mydata="<txtLinkLocation>http%3A%2F%2Fportal.cubewerx.com%2Fcubewerx%2Fcubeserv%2Fcubeserv.cgi%3FCONFIG%3Dhaiti%26SERVICE%3DWFS%26DATASTORE%3DOSM%26request%3DGetCapabilities</txtLinkLocation>";
And, in PHP I get the received data, and I store it as follows:
$receivedXML = $_POST['myxml'];
Now, contains of $receivedXML looks like this:
<txtLinkLocation>http://portal.cubewerx.com/cubewerx/cubeserv/cubeserv.cgi?CONFIG=haiti&SERVICE=WFS&DATASTORE=OSM&request=GetCapabilities</txtLinkLocation>
My question is why URL inside this string is being been automatically decoded? Why is this happening? I do not want any automatic operation to be performed on data that is being sent through AJAX call. How to stop this behavior? I feel like I am missing some fundamental concepts here...