jsonp callback error and parserror
- by Fatima Zahrae Abbadi
im devlopping web app with javascript/html5 client side and im using web service rest in the server i want to get json data from the server and i have problem of cross domain and i use JSONP the problme that i had the callback was not called
this is the code of REST
@GET
@Path("agenda")
@Produces({MediaType.APPLICATION_JSON})
public List<AgendaChambre> getAgenda() {
ArrayList<AgendaChambre>list=new ArrayList<>();
return agenda.findAll();
}
and
function getdata(){
$.ajax({
type: "GET",
dataType:"jsonp",
crossDomain: true,
url: "http://localhost:8080/wsccm/res/ws/agenda?jsoncallback=?",
data: {name: "George Koch"},
jsonpCallback: 'successCallback',
success: function(data1) {
getdata=JSON.stringify(data1);
alert("bieeeeeeeeeeeeeeeeen");
console.log("response:" + getdata);
},
error: function(jqXHR, textStatus, errorThrown) {
alert('error'+errorThrown);
console.log(jqXHR);
}
});