So, through AJAX, you sent a request to another PHP page that process and return some JSON format response like the following:

    "status":"New file uploaded."

So, how are we suppose to parse this JSON in jQuery? Normally, a typical jQuery AJAX request will be as followed:

    url: "test.html",
    // some function here

So, we will want to make sure that the JSON is parsed in done function. To parse the JSON from PHP, we need to get the data from the json variable and after that we can access it just like an array.

var obj = jQuery.parseJSON(json["responseText"]);
// access the filename value from JSON

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s