jquery - Calling the same Controller with filtered data does not show updated view -


i having scenario, first index page loads detailed data in row row fashion. have 3 text boxes requestid, fromdate , todate filter data on page index view. once enter fromdate , todate in respected text boxes , click on button, through javascript code send fromdate , todate same index controller filter data on basis of fromdate , todate.

the index controller gets called fine parameters fromdate , todate, data on basis of fromdate , todate gets filtered properly.

but once filtered data gets send index view displayed doesn't display filtered data, in spite shows existing data.

please find below code reference.

below index controller code.

public actionresult index(int? id, datetime? startdate, datetime? enddate, string status, datetime? closedate)         {             ilist<activesupportindexviewmodel> activesupport;              if(startdate == null && enddate == null)             {                 activesupport = getsupportissuedetails(0, null, null);              }             else             {                 activesupport = getsupportissuedetails(0, startdate, enddate);             }               return view(activesupport);         } 

where activesupport = getsupportissuedetails(0, null, null) gets called , data gets displayed.

after entering fromdate , todate , clicking on button activesupport = getsupportissuedetails(0, startdate, enddate) gets called , filters data.

below java script code written.

<script type="text/javascript">     $(function () {          $("#search").click(function () {             var rid = $('#txtrequestid').val();             var sdate = $('#txtstartdate').val();             var edate = $('#txtenddate').val();             var stat = $('#txtstatus').val();             var cdate = $('#txtclosedate').val();              alert(rid)             alert(sdate);             alert(edate);             alert(stat);             alert(cdate);              $.ajax({                 url: 'home/index',                 type: 'get',                 data: { id: rid, startdate: sdate, enddate: edate, status: stat, closedate: cdate },                  success: function (result) {                     alert(result.name);                     //alert("hello");                 },                 error: function () {                     alert("error");                 }              });             return false;          });      }); </script> 

the javasctip gets execute , sends data controller fromdate , todate.

once getting index controller called fromdate , todate, data gets filtered , gets send view. view not appear fresh filtered data. instead displays message box goes below code of javascript

success: function (result) {                     alert(result.name); 

and existing data remains is.

could please me resolve issue.

please let me know in case of further information. in advance.

in index page create partial file id, in there place data show record.
on ajax success replace partial file ajax data.
refer link


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -