javascript - Get json value from response -
{"id":"2231f87c-a62c-4c2c-8f5d-b76d11942301"} if alert response data see above, how access id value?
my controller returns this:
return json( new { id = indicationbase.id } ); in ajax success have this:
success: function(data) { var id = data.id.tostring(); } it says data.id undefined.
if response in json , not string then
alert(response.id); or alert(response['id']); otherwise
var response = json.parse('{"id":"2231f87c-a62c-4c2c-8f5d-b76d11942301"}'); response.id ; //# => 2231f87c-a62c-4c2c-8f5d-b76d11942301
Comments
Post a Comment