-3

Possible Duplicate:
Access Control Allow Origin not allowed by

I have a problem when i'm trying to do a post with 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 :(");
    });

}

but firefox send "options" and not "post"

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

I have only this problem when i'm doing a cross-domain post?

Community
  • 1
  • 1
user1428798
  • 1,534
  • 3
  • 24
  • 50
  • 1
    Duplicate of [too many to count](http://stackoverflow.com/search?q=Access-Control-Allow-Origin) – Quentin May 31 '12 at 15:41
  • See also the MDC [documentation for CORS](https://developer.mozilla.org/en/http_access_control) especially the bit about [preflight requests](https://developer.mozilla.org/en/http_access_control#Preflighted_requests) – Quentin May 31 '12 at 15:43

1 Answers1

0

change the datatype from json to jsonp also, I cannot see the follow header in your response

Access-Control-Allow-Origin *
Jorge
  • 17,896
  • 19
  • 80
  • 126