I want to send the variables itemId and entityModel to the ActionResult CreateNote:

public ActionResult CreateNote(
        [ModelBinder(typeof(Models.JsonModelBinder))]
        NoteModel Model, string cmd, long? itemId, string modelEntity)

with this javascript:

Model.meta.PostAction = Url.Action("CreateNote", new { cmd = "Save", itemId = itemId, modelEntity = modelEntity});

但是,正在发送的url是

localhost:1304/Administration/blue/en-gb/Entity/CreateNote?modelEntity=Phrase&itemId=44     

I want to send

localhost:1304/Administration/blue/en-gb/Entity/CreateNote?modelEntity=Phrase&itemId=44

How can I prevent Url.Action to put the & in front of the second variable that I want to send?

推荐答案

我昨天没注意到你有&个,我以为是编辑改变了.try 将Url.Action()包装在@Html.Raw()中,以防止对&;进行编码;.

或者只有Url.Action()个控制器/动作位,并将这两个参数作为POST数据传递,而不是直接在URL上传递,jQuery应该以这种方式为您排序&;.

Jquery相关问答推荐

在Click事件上将焦点设置为Kendo UI网格列筛选器文本框

将元素附加到每个函数 jQuery

javascript:无效(0); vs 返回 false vs preventDefault()

jQuery从下拉列表中删除一个选项,给定选项的文本/值

组合数组时无法读取未定义的属性推送

为什么要两次声明 jQuery?

jQuery 插入 div 作为某个索引

如何使用 jQuery Select sibling 元素?

如何在我的 WordPress 插件中包含 CSS 和 jQuery?

如何阻止 Chrome 进入调试模式?

将字符串true和false转为布尔值

jQuery '如果 .change() 或 .keyup()'

jQuery ajax (jsonp) 忽略超时并且不触发错误事件

变量首字母大写

jQuery select2 获取 Select 标签的值?

将十六进制转换为 RGBA

添加到数组 jQuery

bootstrap 日期和时间 Select 器

如何在 jQuery 中取消绑定悬停?

Jquery 日期 Select 器 z-index 问题