“UpdatePanel” in Razor (mvc 3)

前端 未结 5 438
栀梦
栀梦 2020-12-14 12:06

Is there something like UpdatePanel (in ASPX) for Razor?

I want to refresh data (e.g. table, chart, ...) automaticly every 30 seconds. Similar to clicking the follow

5条回答
  •  伪装坚强ぢ
    2020-12-14 12:26

    You can try something similar to the following using Jquery (have not tested though)

    
    

    The above code should be placed in the containing page i.e. not the partial view page. Bear in mind that the a partial view is not a complete html page.

    My initial guess is that this script can be placed in the partial and modified as follows. Make sure that the ajax data type is set to html.

    
    

    Another alternative is to store the javascript in a separate js file and use the Jquery getScript function in ajax success callback.

提交回复
热议问题