I need to check one value from JSON response before continuing the script, but it doesn't work.
$.ajax({
type: "POST",
url: "addproduct.php",
data: {productId : selectedValue, customerId : customerId},
datatype: "json",
success: function (response) {
response = JSON.parse(response);
if(response === undefined) {
alert("undefined");
} else if (response.pricelistupdate = 1) { //this doesn't work
alert("ERROR! Adding a product is denied");
} else {
orderAddRow(response);
}
},
error: function () {
alert("ERROR");
}
});
I'm getting following JSON response:
{"row":{"pricelistupdate":0,"ID":"000017","name":"Chair","discount":"0.00","price":"0.00"}}
Thanks in advance.