我试图设置,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>