简体   繁体   中英

How to running ajax from php 5.2 into php 5.4

I have a problem with ajax script. I create ajax script in php 5.2 the function succes. but when i try in php 5.4 the function not running. Anyone can help me..

Here's My Script.

<script> function makeAjaxCall()
{ 
    $.ajax({ 
        type: "post", 
        data: $('#form1').serialize(), 
        url: "http://192.168.0.77/IWOS_CI/trans_invent_controller/getCode", 
        cache: false,   
        success: function(json){        
        var obj = jQuery.parseJSON(json); 
        var r = obj['STATUS'];
        } 
        });
} 
</script>
<form name="form1" id="form1">
<input type="text" id="kode_trans_invent" name="kode_trans_invent">
</form>

And here my php function from controller.

public function getCode()   
    { 
    $query      = $this->db->query("SELECT count(*) + 1 as count FROM TB_TRANS_INVENT WHERE KODE_TRANS_INVENT ='". mysql_escape_string($_POST['kode_trans_invent']) ."'");
    $queryData  = $query->row_array();
    $phpVar     = array( "STATUS" => $queryData['count']); 
    echo json_encode ($phpVar) ;    
    }

Thanks for the attention..

Nothing in the code you've shown explains why it's not working now. But what I'd do (assuming this problem is actually caused by the PHP version migration) is making sure I'm not using any deprecated functions that could be causing PHP to throw an E_DEPRECATED error that halts the execution. As you're migrating from PHP 5.2 to 5.4, check in these logs:

Deprecated features in PHP 5.3.x and Deprecated features in PHP 5.4.x .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM