user3631967 user3631967 - 4 months ago 10
Javascript Question

How to access property of js object

here is the response code

echo json_encode( array('success' => $stat,'msg'=>$file));


return from the server response

Object {success: "success", msg: "2017_nissan_gtr-2560x14409.jpg"}

Answer
var response = {success: "success", msg: "2017_nissan_gtr-2560x14409.jpg"}
var success = response.success;
var msg = response.msg;