#short
#javascript
#json
amt: "10.00"
email: "[email protected]"
merchant_id: "sam"
mobileNo: "9874563210"
orderID: "123456"
passkey: "1234"
The above is the JSON object I'm dealing with. I want to check if the merchant_id key exists. I tried the below code, but it's not working. Any way to achieve it?
script
window.onload = function getApp()
{
var thisSession = JSON.parse('?php echo json_encode($_POST); ?');
//console.log(thisSession);
if (!("merchant_id" in thisSession)==0)
{
// do nothing.
}
else
{
alert("yeah");
}
}
/script
here: https://developer.mozilla.org/en-US/d...
Watch video javascript - Check if a key exists inside a JSON object online without registration, duration hours minute second in high quality. This video was added by user Code Samples 01 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 376 once and liked it 3 people.