Jquery Chain从数据库中选择脚本

时间:2013-09-02 09:04:44

标签: jquery database codeigniter

请帮我修复我的应用程序的这个脚本,我正在努力让链选择工作。 该脚本基本上从下拉列表中检查所选的下拉值,并在数据库中搜索值

JS:

<Script type="text/javascript">
    $("#propinsi_id").change(function () {
        var propinsi_id = {
            propinsi_id: $("#propinsi_id").val()
        };
        $.Ajax({
            type: "POST",
            url: "<?php echo SITE_URL('Repair/select_fault')?>",
            Data: propinsi_id,
            success: function (msg) {
                $('#city').html(msg);
            }
        });
    });
</Script>

错误:

I caught this error 

Uncaught TypeError: Object
function (selector, context) {
    //The jQuery object is actually just the init constructor 'enhanced'
    return new jQuery.fn.init(selector, context, rootjQuery);
}
has no method 'Ajax'

2 个答案:

答案 0 :(得分:0)

$.Ajax({

需要小写

$.ajax({

我还会将Data:更改为data:

答案 1 :(得分:0)

试试这个

<script type = "text/javascript" >
  $("#propinsi_id").change(function(){
                var  propinsi_id = {propinsi_id:$("#propinsi_id").val()};
                $.ajax({ //<---here
                        type: "POST" ,
                        url: "<?php echo SITE_URL('Repair/select_fault')?>" ,
                        data:propinsi_id, //<---here
                        success:function(msg) {
                            $('#city').html(msg);
                        }
                    });
        });

 </script>