I retreived my json data using Jquery ajax. My data is:
[{"id":"2","checkNo":"74152","routingNo":"896523","accountNo":"741236","confirmAccountNo":"85263","custEmail":"avn@gmail1.com","custName":"jonita gandhi","custStreetAddress":"address2","custPhone":"78456","custCity":"city2","custState":"state2","custZipCode":"4123","amount":"71","memo1":"memo3","memo2":"","cmp":"support","bankName":"Federal Bank","bankAddress":"A-19, Golden avenue","bankCity":"Florida","bankState":"FE","isDeleted":"0","createdDtm":"2017-05-30 14:47:48","updatedDtm":null}]
On Jquery Success i hold the data in a variable
var jsonData = JSON.parse(JSON.stringify(data));
when i am trying to access checkNo. using jsonData[0].checkNo it yields undefined but when i check it using
console.log(jsonData)
It outputs data which is same as top.
Note: This problem yields only on server but it is working fine on my localhost.
Edit:
Here is my ajax call:
jQuery.ajax({
url: postUrl,
data:queryString,
type: "POST",
success:function(data){
switch(action) {
case "edit":
jsonData = JSON.parse(data); console.log(jsonData);
//var jsssss = JSON.parse(JSON.stringify(data)); console.log(jsssss);
$("#custEmail").val(jsonData[0].custEmail);
$("#custName").val(jsonData[0].custName);
$("#custCheckNo").val(jsonData[0].checkNo);
$("#edit_model").modal();
break;
//some more code
}
});