I am using jQuery + ajax to post data to the server and facing issues when xml string is passed.
I want to pass xml string eg., \"\" as
In order to post xml or html to the server, you first have to escape it and then decode on the server.
$.ajax({
type: "POST",
url: "Home/GetResults",
data: {
inputxml: escape('<test></test>')
},
success: function(msg) {
var data = JSON.parse(msg);
alert(data.Message);
},
});
on the server, you would then decode it by:
HttpUtility.UrlDecode(inputxml);