我正在尝试在我的$.get函数完成后执行一个操作,但是下面的代码不起作用。有人能告诉我我做错了什么吗?
$.get('assets/php/paymentaccounts.php', function(data) {
$('#PaymentAccounts').html(data);
}).delay(400).queue(function(next){
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
});发布于 2015-03-01 21:14:51
$.get()返回一个承诺,它没有queue方法。
在回调中添加队列,并附加到jQuery对象,该对象有一个queue方法
$.get('assets/php/paymentaccounts.php', function(data) {
$('#PaymentAccounts').html(data).delay(400).queue(function(next){
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
next();
});
});https://stackoverflow.com/questions/28799106
复制相似问题