XMLHTTPRequest no funciona en navegadores excepto IE

I am trying to get some data using the WCF Rest based service.

Este es mi codigo.

jQuery.support.cors = true;

            url: http://localhost:2545/Service/GetData,
            data: JSON.stringify(temp),
            beforeSend: function (xhr) { xhr.setRequestHeader("Access-Control-Allow-Origin", "*"); },
            type: "POST",
            contentType: "application/json charset=utf-8",
            dataType: "Json",
            crossdomain: true,
            success: function (result) { ProximitySucceeded(result) },
            error: function (result) { debugger; ServiceFailed(result) }

My website is running on http://localhost:1600 and service is on http://localhost:2545.

Its working on IE fine. But on chrome/ firefox /safari returning this error "Origin http://localhost:1600 no está permitido por Access-Control-Allow-Origin ".

Please help as the service is not being accessed from any browser other than IE.

Thanks. Mohit.

preguntado el 08 de noviembre de 11 a las 12:11

¿Por qué intentas usar Access-Control-Allow-Origin como una solicitar ¿encabezamiento? -

Agreed, Access-Control-Allow-Origin is not something that should be set on the request, it should be set by the server on the response. Since you are making the request from localhost to localhost, can you use Wireshark to get at trace of the actual HTTP requests being made? -

1 Respuestas

i think this may be counting as cross site scripting and being denied because the different port makes it a different domain.

to get round this you may need to setup a proxy.

Espero que ayude

respondido 08 nov., 11:17

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.