开发者

How to identify the partial view that is returned in an Ajax callback

I am retrieving a partial view with Ajax that is a form that can be submitted. If the form is submitted and ModelState is not valid I return the view and hookup the buttons again for the form. Wi开发者_如何学JAVAth that I get the validation error messages which works quite nice. But when ModelState is valid I want to return a different partial view that I can attach to a table with the saved information.

My problem is I am not sure how my callback can distinguish between the partial views that is returned, I could look for the starting tags of the html that is returned, but I was wondering if there could be a better way?


With your partial view you can pass a hidden field with value that describes what view is returned. Then parse the returned html with jQuery and get the value of the hidden field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜