开发者

Ajax.BeginForm returns full page

I want to use the Ajax.BeginForm, without updating any element, only call the callback javascript function.

I've attached js libraries

<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive开发者_运维技巧.min.js")" type="text/javascript"></script>

I use:

@using (Ajax.BeginForm(new AjaxOptions {OnComplete = "AddPostComplete"}))
{
//some code
}

and

<script type="text/javascript">
  $('#asdf').click(function () {
        //some code
    });
</script>

the js function isn't used, and the page return full view.


With unobtrusive javascript enabled you will also need to include jquery.unobtrusive-ajax.min.js

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜