I am working with JSON and ajax. I am trying to post a value using AJAX. below is my issue:
My post value:
JSON:
{
"employees": [{
"firstName": "John",
"lastName": "Doe"
}]
}
I am posting JQuery eval() method it converts the JSON object as following:
&firstName=john&lastName=Deo
My problem comes when I try to post a JSON in side a JSON:
{
"employees": [{
"firstName": "John",
"lastName": {
"test1": "10",
"test2": "12"
}
}]
}
When I use eval() method the above JSON object as follows:
&firstName=John&lastName=&test1=10&test2=12
My JQuery Code:
$.ajax({
url: applicationURL,
type: "POST",
data: eval("(" + queryString + ")"),
cache: false,
dataType: "json",
timeout: (60 * 10000),
success: function (data) {
},
error: function (objAJAXRequest, strError) {
}
});
Is there any way to get the values of lastName as JSON object as above? Because eval() method coverts the lastName value also as & separate?