I am struggling/trying since last 24 hours with a simple thing, which i am not able to understand why i am not able to access the PHP variable. I know am doing something wrong and i have no idea what's that..
window.alert("Variable" + <?php echo $_POST; ?> );
Its giving me output as Function Array() {[native code]}
, How can i print the values ? and i think the POST attribute is blank, Can anyone check ? Why POST variable is blank ?
I am sending data to the file via POST method as
<script type="text/javascript">
function callAjaxAddition() {
arguments0 = {
arg1: $("#exampleForm input[id='pac-input']").val(),
arg2: ("#exampleForm input[id='pac-input']").val()
};
$.ajax({
type: "POST",
url: "processAjax.php",
data: {
arguments: arguments0
},
success: function(data) {
$("#answer").html('<ul><li>' + data + '</li></ul>');
send_apptn_req();
}
});
return false;
}
</script>
and ProcessAjax.php file is
<?php $a=0;foreach($_POST['arguments'] as $v) $a= $v;echo $a;?>
Thanks in advance please..