llame a un formulario de solicitud vaadin php con jquery [duplicado]
Frecuentes
Visto 558 veces
0
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:
$.get(
"http://192.168.10.106:8080/FTTBManager/?restartApplication",
{ activate: "1", username: "Ahmed1.Hiwa@gold" },
function(result) {
alert ("Result Was : " +result);
$('#divout').html(result);
},
"text"
)
pero me sale el siguiente error:
Origin localhost is not allowed by Access-Control-Allow-Origin.
3 Respuestas
0
You seem to be trying to access a URL from a server (192.168.10.106:8080) 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 (192.168.10.106:8080) 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
0
/FTTBManager/ url is php page add
header('Access-Control-Allow-Origin: *');
Respondido 28 ago 12, 13:08
0
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
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 java javascript jquery vaadin or haz tu propia pregunta.
Where is this code running from?
http://192.168.10.106
? - EricYour error is pretty descriptive - Hazem Salama
go to these stackoverflow links: - access-control-allow-origin-not-allowed-by - origin-is-not-allowed-by-access-control-allow-origin - jquery-xml-rest-access-control-allow-origin - [xmlhttprequest-origin-null-is-not-allowed-access-control-access-allow-for-file](stackoverflow.com/questions/4208530/xmlhttprequest-o - Dariush Jafari