Ich habe Probleme mit dem Aufruf einer Ruhe-API mit sammyjs. Ich erstelle eine Singlepage-App, und bisher funktioniert es in sammy js, da meine partiellen htmls geladen sind. Aber mein Hauptziel ist auf Aufruf einer Hash-URL Ich möchte eine API aufrufen, um Daten zu erhalten und nachdem die Anfrage fertig ist rendern die Seite (auf Rückruf), aber es wird "jquery.js: 9631 GET http://localhost:8080/home/stats 404()" wenn es versucht, die API anzurufen.Wie führen Sie eine REST-API alle in sammy js
<script>
$(document).ready(function() {
var app = $.sammy('#content', function() {
this.use(Sammy.JSON)
this.get('#/home', function (context) {
//var loadOptions = { type: 'get', dataType: 'json', data: {query: variable}, };
this.load('http://localhost:8080/home/stats')
.then(function(items) {
$('#content').load("partials/home.html");
});
});
app.run('#/home')
});})
</script>