阿贾克斯无法解雇

时间:2014-08-27 13:06:14

标签: javascript jquery ajax

我试图设置,ajax自动完成,但它无法解雇不知道我真正做错了什么,请看一下我的代码,这是我的整个脚本,就像自动填充功能在底部。

<script type="text/javascript">

$(function(){
    $('#type').change(function(){
        $.ajax({    url: '<?php echo $this->baseUrl()?>/admin/ajax/add-form/type/' + encodeURIComponent($('#type').val()),
                    dataType: 'json',
                    success: function(data)
                    {
                        $("#more").html(data.form);
                        if ($('#type').val() == 'monthly')
                        {   
                            yearchange();
                        }
                        if ($('#type').val() == 'quarterly')
                        {   
                            quarterlyyearchange();
                        }
                    }       
                });
    });
});

    function yearchange()
    {
            $('#year').change(function(){
                $.ajax({    url: '<?php echo $this->baseUrl()?>/admin/ajax/excel-monthly/year/' + encodeURIComponent($('#year').val()),
                dataType: 'json',
                    success: function(data)
                    {
                        $("#more").html(data.form);
                        yearchange();
                    }       
                });
            });
    }

    function quarterlyyearchange()
    {
            $('#quarterlyyear').change(function(){
                $.ajax({    url: '<?php echo $this->baseUrl()?>/admin/ajax/excel-quarterly/year/' + encodeURIComponent($('#quarterlyyear').val()),
                dataType: 'json',
                    success: function(data)
                    {
                        $("#more").html(data.form);
                        quarterlyyearchange();
                    }       
                });
            });
    }

        function sicchange()
    {
            $('#search').change(function(){
                $.ajax({    url: '<?php echo $this->baseUrl()?>/admin/ajax/excel-sic/search/' + encodeURIComponent($('#quarterlyyear').val()),
                dataType: 'json',
                    success: function(data)
                    {
                        $("#more").html(data.form);
                        sicchange();
                    }       
                });
            });
    }

    /*********************************Add Autocomplete*******************************************/
    function addac()
    {
        $( "#search" ).autocomplete({
            minLength: 2,
            dataType: 'JSON',
            source: function(request, response)
            {
                    $.ajax({    url: '<?php echo $this->baseUrl()?>/admin/ajax/ac-sic/phrase/' + request.term,
                                dataType: 'json',
                                success: function(data)
                                {
                                    response(data);
                                }
                                })
                          }

                          });
    }

</script>

0 个答案:

没有答案