如何在函数内重新加载函数?
How can I reload a function inside a function?
通过单击 edit-item
我正在通过 ajax 加载表单:
$('.table tbody').on( 'click', '.edit-item', function (e) {
forms(e,this);
});
使用此表单我的 select 字段 #form_productgroup
已加载。在更改时,我想再次重新加载表单。
我的做法:
$('.table tbody').on( 'click', '.edit-item', function (e) {
forms(e,this);
$(document).on('change', '#form_productgroup', function(e) {
forms(e,this);
});
});
但是表格没有重新加载。
试试这个:
$(document).on( 'click', '.edit-item', function (e) {
forms(e,this);
});
$(document).on('change', '#form_productgroup', function(e) {
forms(e,this);
});
我觉得可行!
编辑:
IT 的工作是因为 $(document).on(...)
在加载组件时被调用。
通过单击 edit-item
我正在通过 ajax 加载表单:
$('.table tbody').on( 'click', '.edit-item', function (e) {
forms(e,this);
});
使用此表单我的 select 字段 #form_productgroup
已加载。在更改时,我想再次重新加载表单。
我的做法:
$('.table tbody').on( 'click', '.edit-item', function (e) {
forms(e,this);
$(document).on('change', '#form_productgroup', function(e) {
forms(e,this);
});
});
但是表格没有重新加载。
试试这个:
$(document).on( 'click', '.edit-item', function (e) {
forms(e,this);
});
$(document).on('change', '#form_productgroup', function(e) {
forms(e,this);
});
我觉得可行!
编辑:
IT 的工作是因为 $(document).on(...)
在加载组件时被调用。