I have a php array
array(6) {
["merchant_id"]=> string(6) "ajeesh"
["passkey"]=> string(4) "1234"
["amt"]=> string(5) "10.00"
["email"]=> string(16) "ajeesh@gmail.com"
["mobileNo"]=> string(10) "9874563210"
["orderID"]=> string(6) "123456"
}
which I got as a result of var_dump($_POST)
.
How can I copy all this value to a javascript array variable?How can it be possible? Suppose if the javascript array I made is
var thisSession = new Array();
TRY
I have tried this in the javascript
<script>
window.onload = function getApp(){
var thisSession = JSON.parse('<?php echo json_encode($_POST); ?>');
alert (thisSession);
}
</script>
and this in the php
json_encode($_POST);
but the javascript is alerting "Object object".Im not gettign the array!why?