0
Ich versuche, eine Ajax-GET-Anfrage mit Jquery zu senden, aber ich diesen Fehler:JQuery Ajax Get Typeerror: Illegale Aufruf
Uncaught TypeError: Illegal invocation at e (jquery.min.js:4) at dc (jquery.min.js:4) at dc (jquery.min.js:4) at Function.n.param (jquery.min.js:4) at Function.ajax (jquery.min.js:4) at home.js:2
var cid = document.getElementById("id").value;
$.ajax({
type : "GET",
url : windowLocationS + "findTourByCustomId",
data : {
id : cid
},
async : false,
cache : false,
dataType : "json",
contentType: "application/json",
success : function(jsn) {
console.log(jsn.length);
},
error : function(error) {
console.log(error);
}
});
Controller:
@RequestMapping(value= "/findTourByCustomId", method = RequestMethod.GET, headers = "Accept=application/json")
public List<classA> findTourByCustomId(@RequestParam(value = "id", required = true) String id) {
return service.findByCustomId(id);
}
Wie kann ich die Daten erfolgreich bekommen?
Ist das js Code-Snippet, das Sie in Ihrer Frage haben, Ihre 'home.js' Datei? – eeya
@eeya ja, ist der Code-Schnipsel in 'home.js' –
Wenn wir können, können Sie Ihre Frage aktualisieren und uns zeigen, wie beziehen Sie die' '