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
Post a Comment