如何在asp mvc 5中的ajax.BeginForm中设置dataType jsonp

时间:2016-12-25 21:15:24

标签: types jsonp ajax.beginform

我想在ajax.BeginForm中设置dataType jsonp 例如 这个当前的代码

Url = "/api/Phrase/Create",
OnSuccess = "OnSuccess(data)",
OnFailure = "OnFailure",
HttpMethod="POST"

更改为

Url = "/api/v3/Phrase/Create",
OnSuccess = "OnSuccess(data)",
OnFailure = "OnFailure",
HttpMethod= "POST",
dataType= "jsonp"

就像在jquery中一样:

$.ajax({
            type: "POST",
            url: "/api/v3/Phrase/Create",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(model),
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
});

如果您能提供帮助请重播此请求 否则应该做点什么 谢谢所有

0 个答案:

没有答案