javascript - How to retrieve JSON variables from a AJAX response -
when tried fetch values json response, stucked up. here code
code:
$.ajax({ url: 'checkvotes.php', datatype: "json", success: function(data) { // want fetch , down variables json here } });
ajax response php
{"sample":[{"id":"1","message":"my message","up":"200","down":"34"}]}
$.ajax({ url: 'checkvotes.php', datatype: "json", success: function(data) { var = data.sample[0].up; var down = data.sample[0].down; } });
Comments
Post a Comment