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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -