如何检测我的选择形式是通过Ajax成功而改变的



我有两个表单输入(文本和选择表单(。当用户搜索员工数据时,选择表单会通过AJAX成功更改。现在,我想要其他jQuery函数,可以自动检测何时通过ajax成功更改选择表单,并检索其他函数使用的选择表单的新值,以在我的输入文本中使用新数据。

我的搜索员工功能

    function search_personal_result(formObj, urlres, responseDIV, disable_data, modal_class,result_data)
{
    disable_data=disable_data||false;
    modal_class=modal_class||false;
    result_data=result_data||false;
    var loading = '<p>Loading ...</p>';
        $.ajax({
        url: site_url+'/'+urlres,
        beforeSend: function(){
            $(responseDIV).html(loading);
        }, 
        data: $(formObj).serialize(), 
        type: "post", 
        dataType: "html",
        success: function(response){
            //proceed data result here
            if(result_data==false){
                var obj = jQuery.parseJSON(response);
                $.each(obj, function (index, value) {
                    if(result_data==false){
                        for(var j in value){
                            //My SELECT Form Changed here
                            $('#VCIDSBU').val('MY NEW VALUE');
                        }
                    }
                });
            }
        },
        error: function(){
            alert("Terjadi kesalahan!");
        },
    });
}

如果用户使用search_personal_result搜索员工数据,则我的选择表格已成功更改。

现在我需要的是,如何制作可以检测到我的选择表单已通过search_personal_result

更改的其他jQuery函数

我尝试使用

$(function () {
    $('#form_create_sp').on('change','SELECT#my_select_id',function(){
            alert('it changes');
    });
})

它只能在用户手动更改选择表单时检测。但是当选择表单更改为search_personal_result

时不起作用

感谢此处的所有专家

您始终可以执行某种类型的console.log(" success"(;功能基于是否发送。

最新更新