jquery - JSON data retrieval using javascript -



jquery - JSON data retrieval using javascript -

hello guys i'm working user login , when user submits login credentials api beingness called using ajax , if login credentails correct/ wrong i'm getting response , after stringifying info displayed in next format in console.

if true {"$p_success":true}

if false {"$p_success":false}

now want read value true above string , want redirect user new page based on condition.

i tried different options in vain.

thanks help in advance.

you can access property of object specifing name between [] (ex: object['name']).

class="snippet-code-js lang-js prettyprint-override">var redirect = json.parse('{"$p_success":true}') var success = redirect['$p_success']; // value of $p_success alert(success);

javascript jquery ajax json

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -