Ajax.Actionlink opens in a new page

☆樱花仙子☆ 提交于 2019-12-04 01:17:19

问题


I have a partial view that needs to get loaded between two div but when the ajax.actionlink is invoked it open the content in the partial view in a new browser window. I use UpdateTargetId = "ajaxReplace"

Regards


回答1:


Did you include/reference all the necessary javascript files?

You say you use MVC 3.

If you have UnobtrusiveJavaScriptEnabled then you'll need:

  • jQuery
  • jquery.unobtrusive-ajax.js

if you also use client side validation, you'll need;

  • jquery.validate.js
  • jquery.validate.unobtrusive.js

These files can all be found when you create a new MVC3 project.




回答2:


[OutputCache(Duration=0)]

on the controller method. I had this with an AJAX.ActionResult which worked well in FF but not in IE8. IE8 must send back some stuff that lets the caching engine just return the value.



来源:https://stackoverflow.com/questions/4313941/ajax-actionlink-opens-in-a-new-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!