0

问题

我的应用程序没有提醒

Javascript - /assets/js/global.js

$(document).ready(function(){
    $("#view").click(function(){
        var customer_id = $("#customer_id").val();

        //alert(customer_id);
        $.post('/index.php/ajax/customer_comission',
        {'customer_id' : customer_id },
        //Server responds to request
        function(result){
            alert(result);
        });
    });
});

看法

<p>
    <label for="customer_list">Customer Name</label>

    <?php echo form_dropdown('customer_id',$cust,'','id = "customer_id"'); ?>
</p>
<?php
    $btn_data = array(
        'name' => 'View',
        'id' => 'view',
        'content' => 'View Commission'
    );
?>

<?php echo form_button($btn_data); ?>

控制器 - ajax.php

class Ajax extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
    }
    function index()
    {
    }
    function customer_comission()
    {
        echo 'AJAX response !';
    }
}
4

0 回答 0