I am using jqGrid in my ASP.NET MVC application. The jqGrid is in partial page and loaded from View page using jQuery Ajax. The grid is loaded fine during initial load. Now I would like to refresh the data in the jqGrid from database every 20 seconds i.e. new or updated data in the database should be shown in the jqGrid every 20 seconds. I have used JavaScript setInterval to set the 20 seconds interval which calls the JavaScript function to refresh the new data in jqGrid. I am able to fetch the new data from database in the controller from jQuery Ajax and using the below code in success function to refresh the data in jqGrid.
var grid = jQuery('#JQGridName'); grid.jqGrid('setGridParam', { datatype: 'json', data: jsonData, rowNum: 100 });
How would I get the new data from controller to View Page which will be used in above code snippet to reload the jqGrid ? Please note my jqGrid is in Partial Page and above code snippet is called from main View Page.