Consulta de Web Services con ajax.Query
Publicado por Johnny (6 intervenciones) el 11/04/2017 23:48:48
Estimados estoy tratando de realizar una consulta via web services segun este código:
Pero me sale el siguiente error:
XMLHttpRequest cannot load http://192.168.10.237:8080/wr-dni-afiliados/server/consulta/getDatos. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.50.33' is therefore not allowed access.
Alguien me pude dar la solución?
Gracias!!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var request = $.ajax({
url: "http://192.168.10.237:8080/getDatos",
type: "POST",
dataType: "json",
//data: JSON.stringify({ data:{ "campo": numdoc }}),
data: { "campo": numdoc },
contentType: "application/json; charset=utf-8",
headers: {
'Access-Control-Allow-Origin' : '*',
},
beforeSend: function() {
$("#beforecargando01").html("cargando...");
},
success: function(data) {
//alert(data['data']);
alert(data);
},
error: function(data, textStatus, errorThrown) {
alert('data error: ' + textStatus);
}
});
Pero me sale el siguiente error:
XMLHttpRequest cannot load http://192.168.10.237:8080/wr-dni-afiliados/server/consulta/getDatos. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.50.33' is therefore not allowed access.
Alguien me pude dar la solución?
Gracias!!!
Valora esta pregunta
0