-3

可能重复:
访问控制允许来源不允许

当我尝试使用 jquery 发帖时遇到问题:

             function SetUserAnswer(reponse) {
    $.ajax({
        type: "POST",
        url: "@SettingManager.GetValue("WS_Sondage_Adress").Value" + "SetUserAnswer",
        data: JSON.stringify({ deviceId: $("#Guid").attr("value"),
            pollId:  $("#PollId").attr("value"),
            answerId: reponse,
            parameters: ""
        }),
       dataType: "json",
       crossDomain: true,
      contentType: "application/json; charset=utf-8"
    }).done(function () {
        alert("OK !");
    }).fail(function () {
        alert("KO :(");
    });

}

但 Firefox 发送“选项”而不是“发布”

OPTIONS SetUserAnswer

405 Method Not Allowed

22.1.68.146:8080

1.7 KB

10.70.134.7:8080


80ms
En-têtesRéponseHTML
Réponsevoir le code source
Access-Control-Allow-Orig...    *
Age 0
Allow   POST
Cache-Control   private
Connection  Keep-Alive
Content-Length  1732
Content-Type    text/html; charset=UTF-8
Date    Thu, 31 May 2012 15:28:21 GMT
Proxy-Connection    Keep-Alive
Server  Microsoft-IIS/7.0
X-AspNet-Version    4.0.30319
X-Powered-By    ASP.NET
Requêtevoir le code source
Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language fr,en-us;q=0.8,fr-fr;q=0.5,en;q=0.3
Access-Control-Request-He...    content-type
Access-Control-Request-Me...    POST
Cache-Control   no-cache
Host    22.1.68.146:8080
Origin  nom_machine
Pragma  no-cache
Proxy-Connection    keep-alive
User-Agent  Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0

我在做跨域发帖时只有这个问题?

4

1 回答 1

0

将数据类型从更改jsonjsonp也,我在您的回复中看不到后续标题

Access-Control-Allow-Origin *
于 2012-05-31T15:50:16.900 回答