How to get Json values ​​using Jquery


Hi I'm new to Jquery and i don't know how to use json data. I have a Json which is coming as a response. My success function is

success: function(resp)
    var x = JSON.stringify(resp);


alert is having following JSON


I want action value alone. How can i get this value from x variable and how can i utilize this value in HTML. Thanks in advance.

When you use JSON.stringify() you are turning it into a string, you want it as an object to access the data. Try this:

success: function(resp) {
    var x =[0].action  // to use the value in html later on

If it is returned as a string (I can't tell at this point), you can turn it into an object (as long as it is valid JSON) by using $.parseJSON()