是否可以使用 Ajax.BeginForm 在另一个域上调用 api?
Is it posible use Ajax.BeginForm to call an api on other domain?
如果我在同一个域中有一个 api 和他的方法。我可以做类似的事情,而且它显然有效。
@using (Ajax.BeginForm("ApiMethod", "ApiControllerName"))
{
... Forms elements
}
有没有办法指定域?
ps:我不想使用jquery。
根据 the documentation, you can use the BeginForm(AjaxHelper, AjaxOptions)
overload. Then looking at the AjaxOptions documentation,class 有一个 Url
属性 您应该可以设置。
如果我在同一个域中有一个 api 和他的方法。我可以做类似的事情,而且它显然有效。
@using (Ajax.BeginForm("ApiMethod", "ApiControllerName"))
{
... Forms elements
}
有没有办法指定域?
ps:我不想使用jquery。
根据 the documentation, you can use the BeginForm(AjaxHelper, AjaxOptions)
overload. Then looking at the AjaxOptions documentation,class 有一个 Url
属性 您应该可以设置。