jQuery AJAX type: 'GET' make problems with PHP -


i tried until morning retreive data mysql , ajax.

this code :

html :

$.ajax({    //type:'get',    url: "/lecture_message_pilote.php",    data: ({location_id:zlid}),    contenttype: "application/json; charset=utf-8",    datatype: 'json',                //data format    success: function(data)          //on recieve of reply    {        var zidpilote = data[0];              //get id        var zmessage = data[1];           //get name        alert(zmessage);    } }); 

and php :

$result = mysql_query("select * test_phonegap_message idpilote = '".$location_id."'"); $array = mysql_fetch_row($result);   echo (json_encode($array));  mysql_close(); 

i've error message : undefined alert(zmessage); if use php request :

$result = mysql_query("select * test_phonegap_message"); 

i have result. think php don't take $location_id.

try access parameter via $_request["location_id"] element of php.

i.e.

$result = mysql_query("select * test_phonegap_message idpilote = '".$_request["location_id"]."'"); $array = mysql_fetch_row($result); 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -