简体   繁体   中英

Get Success Value from ajax request

I have following response from my ajax request

response: {
 Success : false;
 Success Message: '';
 ErrorMessage: 'Test';
}

I want to get Success value in console.log but I am not able to get this.

I am getting response text like this.

var o = $.parseJSON(jqXhr.responseText);
console.log(o);

This gives me entire response in console, but when I try to get success message only like this.

console.log(o.Success);

It give me undefined. Anyone please identify what I am doing wrong here.

JSON fields should be separated by comma, not by a semicolumn. I'm guessing thats why parseJSON doesn't convert it properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM