ASP. net mvc 4 partial refresh
Zookeeper
I will talk about my ideas directly:
Use Ajax + PartialView to partially refresh the time.
First, a PartialView is referenced on the page. When Using Ajax to update data, the entire PartialView content must be updated simultaneously.
Ajax code:
$. Ajax ({url: "url", type: "Post", data: {"sectionid": sectionId, "questions": ids. join (",")}, success: function (data) {// TODO: Process events after the new questionnaire is successfully added $ ("Selector" example .html (data );}, error: function (XMLHttpRequest, textStatus, errorThrown) {alert ("failed to save:" + errorThrown );}});
Background C # code:
[HttpPost] public ActionResult UpdateSection (int sectionid, string questions) {try {// update PartialView return PartialView ("ViewSection", newSection);} catch (Exception exp) {throw exp ;}}
This is simple, and there is no need to splice strings or something.
Zookeeper