Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic questions - Question:Json Ajax PHP is NULL

I get an array with the geolocation Javascript, then I want to pass this array to a php script via ajax to process it and get an processed array back. Unfortunately it seems that the passed array to php is always NULL, I have no idea why, maybe you can help me out. Thank you!

my js/jquery:

dataArray = [];
        var lat = pos.coords.latitude;
        var lon = pos.coords.longitude;
        var identifier = 'ajax';

                async:   true,
                type:        'post',
                cache:       false,
                url:         'custom.php',
                data:        {myJson: dataArray},
                dataType   : 'json',
                success: function(data){
                    var json = $.parseJSON(data);

my php:

$JSArray['array'] = json_decode($_POST['myJson'], true);
$_SESSION['jsonArray'] = $JSArray['array'];

The Result is always ["jsonArray"]=> NULL

asked Sep 13, 2013 in jquery by anonymous
edited Sep 12, 2013
0 votes

Related Hot Questions

Government Jobs Opening