本文介绍了刷新htmlpagedlist上的部分html点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用mvc razor .. 在那里,我从其他行动结果中调出一个动作结果 for exp,如果我在主页上,我点击,产品列表, 这是actionresult和视图名为productlist.cshtml 我使用型号在productlist.cshtml中传递数据表.. 并使用 < div id = some_grid_container > foreach(模型中的var项目){ } < / div > 在此之后,我使用 < div id = myPager > @ Html.PagedListPager(模型,Page_No => Url.Action(@ ViewBag.cururl,new {Page_No,destn,callhere})) < / div > 在PagedListPager中点击href时,,页面刷新, 所以我不想刷新页面,所以我试过 $('#myPager')。on('click','a', function(){ $ .ajax({ url:this.href, type:'GET', cache:false, success:function(result) ){ alert(result); // $('#some_grid_container')。html(result); },错误:function(xhr,textStatus,errorThrown) { // document.write(FAIL:+ xhr.responseText + - + textStatus.responseText + - + errorThrown.responseText); alert(FAIL:+ xhr。 responseText + - + textStatus.responseText + - + errorThrown.responseText); } }); re转错; }); 这不刷新整个页面,但这显示整个html页面从div id =some_grid_container开始.. 如何只刷新some_grid_container,其中Page_no = 2,然后是3 ......等...... 我希望你理解解决方案 ('#myPager')。on('click','a',function(){ .ajax({ url:this.href, type:'GET', cache:false, success:function(result) ){ alert(result); // ('#some_grid_container')。html(result); },错误:function(xhr,textStatus,errorThrown){ // document.write(FAIL:+ xhr.responseText + - + textStatus.responseText + - + errorThrown.responseText); alert(FAIL:+ xhr.responseText + - + textStatus.responseText + - + errorThrown .responseText); } }); 返回false; }); 这不刷新整个页面,但这显示整个html页面从div id =some_grid_container开始.. 如何只刷新some_grid_container,其中Page_no = 2,然后是3 ......等...... 我希望你理解 I am using mvc razor ..There , i call a actionresult from other actionresultfor exp, if i am on home page , and i click ,productlist , this is actionresult and as view called productlist.cshtmlI pass datatable in productlist.cshtml using model ..and display in table using <div id="some_grid_container">foreach (var item in Model) { }</div>and after this , i use<div id="myPager">@Html.PagedListPager(Model, Page_No => Url.Action(@ViewBag.cururl, new { Page_No,destn,callhere}))</div>on a href click in PagedListPager , the page refreshes, so i dont want to refresh page, so i tried $('#myPager').on('click', 'a', function () { $.ajax({ url: this.href, type: 'GET', cache: false, success: function (result) { alert(result); // $('#some_grid_container').html(result); }, error: function (xhr, textStatus, errorThrown) { // document.write("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText); alert("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText); } }); return false;});this doesnot refresh whole page , but this shows whole html page from start inside div id="some_grid_container"..how to refresh only div some_grid_container with Page_no =2 values , then 3 ...etc...I hope you understood 解决方案 ('#myPager').on('click', 'a', function () {.ajax({ url: this.href, type: 'GET', cache: false, success: function (result) { alert(result); //('#some_grid_container').html(result); }, error: function (xhr, textStatus, errorThrown) { // document.write("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText); alert("FAIL: " + xhr.responseText + "-" + textStatus.responseText + "-" + errorThrown.responseText); } }); return false;});this doesnot refresh whole page , but this shows whole html page from start inside div id="some_grid_container"..how to refresh only div some_grid_container with Page_no =2 values , then 3 ...etc...I hope you understood 这篇关于刷新htmlpagedlist上的部分html点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 01:01