jQuery ajax调用后,Tablesorter功能不起作用? [英] Tablesorter functionality not working after jquery ajax call?

查看:217
本文介绍了jQuery ajax调用后,Tablesorter功能不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

document ready()函数中,我绑定下拉列表并调用下拉列表chagefunction()和绑定表结果.但是tablesorter()在该ajax调用后不起作用.请让我知道如何调用tablesorter().

In document ready() function i am binding dropdowns and calling dropdowns chagefunction() and binding table results.But tablesorter() not working after that ajax call.,please let me know how to call tablesorter().

$(function () {

  $("#filterByApplicationName").change(function () {
calling ajax post method to load the second dropdown based on first dropdown
 $.post("<%=Url.Action("GetRolesByApp", "Search")%>",{ appId:appid }, function (result) {
//getting result bindign data to dropdown.


}

//calling submit form to get the results of application info
SubmitForm();


}

 function SubmitForm() {

$.post('/Search/ShowResult',
                f.serialize(),
                function (html) {  
--result
});

$("#tblresults").tablesorter(); not working.
}

推荐答案

问题是change函数不适用于ajax加载脚本.因此,请使用代替$(".dropdownclass").change(function(){:

the problem is the change function is not applied for ajax load scripts. so instead of $(".dropdownclass").change(function(){ use:

// attach a delegated event to document
$(document).on("change",".dropdownclass", function(){

这篇关于jQuery ajax调用后,Tablesorter功能不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆