I am building a web site and I use a url which returns a JSON response, like:
{name:mark; status:ok}
I would like to obtain the name, using onl
Have a look at jQuery's .getJSON() method, which will make it really easy for you.
$.getJSON('yourURL.php', function(data) {
alert(data.name);
});
If you need more flexibility you should have a look at .ajax() instead. .getJSON()
is really just a short hand for the .ajax()
method, suitable for making simple requests to fetch JSON. With .ajax()
you will have a lot of more options - specifying an error handler for instance, and much more.