Closed
Description
I am using jQuery v2.1.4.min.js library.
I am calling ajax giving some parameters to it as like following:
First Case
var myData = '{"userId":"abc", "password":"abc??"}';
$.ajax({
type: "POST",
url: myUrl,
data: myData,
dataType: "json",
success: function(serviceData) {
console.log(JSON.stringify(serviceData));
},
error: function(err) {
console.log("Error: "+err);
}
});
I have given password having two question marks(??) so it is manipulating it automatically as
{"userName":"abc", "password":"abcjQuery21406515378922229067_1479880736745?"}:
When I remove the dataType: "json",
it works fine.
Second Case
When I write above code with ContentType as:
var myData = '{"userId":"abc", "password":"abc??"}';
$.ajax({
type: "POST",
url: myUrl,
contentType: "application/json; charset=utf-8",
data: myData,
dataType: "json",
success: function(serviceData) {
console.log(JSON.stringify(serviceData));
},
error: function(err) {
console.log("Error: "+err);
}
});
It works fine. No issue.
I am using Java RestEasy Service for handling the ajax requests.
Metadata
Metadata
Assignees
Labels
No labels