what is the error here :
.done(function(data) {
var json = JSON.parse( data );
if(json['status'] === "success"){
//some processing
}
else {
alert( "error 2" );
}
})
I got the error message on: var json JSON.parse('('+data+')')
data is returned from a php script :
/*...............*/
$sql->execute();
$i = 0;
while($result = $sql->fetch(PDO::FETCH_ASSOC){
$response["affiliates"][i]["affiliate_name"] = $result["coupon_name"];
$response["affiliates"][i]["affiliate_id"] = $result["coupon_id"];
$i++;
}
$response["status"] = "success";
echo json_encode($response);