llame a un formulario de solicitud vaadin php con jquery [duplicado]

Posible duplicado:
Control de acceso Permitir Origen no permitido por
El origen no está permitido por Access-Control-Allow-Origin

I used this code to call a vaadin application from PHP page:

    { activate: "1", username: "Ahmed1.Hiwa@gold" }, 
    function(result) {
        alert ("Result Was : " +result);

pero me sale el siguiente error:

Origin localhost is not allowed by Access-Control-Allow-Origin.

preguntado el 28 de agosto de 12 a las 13:08

Where is this code running from? -

Your error is pretty descriptive -

3 Respuestas

You seem to be trying to access a URL from a server ( different from the one where the page is loaded from (localhost). This is called a cross-origin request and is blocked by most modern browsers. If you want to allow this request, the target server ( has to provide this information in its HTTP headers.

Ver http://en.wikipedia.org/wiki/Cross-origin_resource_sharing para más detalles

Please be aware that Internet Explorer 8 seems to block any requests from localhost to non-localhost even if the target server has the CORS headers. Therefore you may want to test the same thing on a non-localhost server or in a different browser.

Respondido 28 ago 12, 13:08

/FTTBManager/ url is php page add

header('Access-Control-Allow-Origin: *');

Respondido 28 ago 12, 13:08

same origin policy does not allow you to do an ajax request to another domain/port/protocol
and vaadin application is not supposed to work like that
You can try embed the vaadin application in your php page with iframe

You can try this fiddle

Respondido 28 ago 12, 13:08

I had changed to localhost but I am still get same error - danarj

thank you for the answer. the vaadin application is a worker thread without a GUI or anything similar. how would the iframe solve the problem in this scenario ? - danarj

if it doesn't have any UI, why do you want to use Vaadin? and iframe still solve problem in this case, just don't let the iframe display (you can programmatically create an iframe on your event handler), the request will still be made. if it has to be ajax/xhr, you can send request to your vaadin application in one of your php pages, the ajax request will send request to that php page - esperanza_es_grim

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