【发布时间】:2008-10-22 10:17:37
【问题描述】:
我正在尝试发布到 ADO.NET 数据服务,但参数似乎在此过程中丢失了。
我得到了类似的东西:
[WebInvoke(Method="POST")]
public int MyMethod(int foo, string bar) {...}
我使用prototype.js进行ajax调用:
var args = {foo: 4, bar: "'test'"};
new Ajax.Requst(baseurl + 'MyMethod',
method: 'POST',
parameters: args,
onSuccess: jadda,
onFailure: jidda
}
如果我将“method: 'POST'” 替换为“method: 'GET'” 并将“WebInvoke(Method="POST")” 替换为“WebGet” 一切正常,但现在(使用 post)我得到的只是:
错误请求 - 查询语法错误。
来自服务。
唯一的解决方法(我不想使用)是发送 URL 中的所有参数,即使在我执行发布时也是如此。欢迎任何想法。
【问题讨论】:
标签: .net javascript ajax wcf ado.net