PHP Jquery JSON catching -


here's php responding jquery calls.

<?php    if ( isset( $_post['icnumber']) && $_post['icnumber'] != '' ) {     $custic = $_post['icnumber'];     $response = array();     $response['status'] = 'false';     $sql ="select * ctrl_cust cust_ic='$custic'";     $raw = mysql_query($sql,$link) or die('query 1 '.mysql_error());     if ( $data = mysql_fetch_assoc( $raw ) ) {        $response['status'] = 'true';        $response['custid'] = $data['cust_id'];        $response['custname'] = $data['cust_name'];     }     header("content-type: application/json", true);     echo json_encode($response);     } ?> 

and here's jquery

$(function() {     $('#icnumber-form').submit(function() {                var icno  = $('#icnumber').val();         $.ajax({            type    : 'post',            url     : 'php/create_process.php',            data    : icno,            datatype: 'json',            success : function(data){                console.log(data);                         },            beforesend:function(){                $('.cust-exist-view').fadein();            }        });        return false;     }) }); 

the thing is, console.log returns null, when submit form without javascript enabled, returns :

{"status":"true","custid":"00001","custname":"john"} 

i wonder problem...i've been running around in circles hours...help me please?

icnumber not getting post, change data: icno, data: {icnumber: icno}, , try


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -