停止在歌剧中工作ajax请求

时间:2012-05-03 08:48:26

标签: jquery ajax asp.net-mvc opera

HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>TestGamePlay</title>
    <link href="/Content/Site.css" rel="stylesheet" type="text/css" >
    <script src="/Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>

</head>
<body>

<div id="js1">
</div>
<span><a data-ajax="true" data-ajax-method="Post" data-ajax-mode="replace" data-ajax-update="#js1" href="/Kamikaze2/Start?cost=5&amp;gameId=84cada66-c01b-419d-9df3-620663a1dc8d">5</a></span> 
</body>
</html>

控制器:

[AjaxOnly]
        public ContentResult Start(int cost, Guid gameId)
        {
return new ContentResult() { Content = "Start game" };
}

仅限ajax属性

public class AjaxOnlyAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (!filterContext.HttpContext.Request.IsAjaxRequest())
            filterContext.HttpContext.Response.Redirect("/");
    }

    public override void OnActionExecuted(ActionExecutedContext filterContext)
    {

    }
}  
在mozile中一切正常。歌剧(v.11.62)我重定向到&#34; /&#34;

可能是什么原因

1 个答案:

答案 0 :(得分:0)

我重新启动计算机并且工作正常