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

silverlight - Applying a style to ItemContainerStyle in C# -

drupal - using views argument in the view tpl.php file -

php - Posting PHPBB Forum Thread/Post info in a website -