I am having issues with calling a rest api with sammyjs. I am creating a singlepage app, and so far it works in sammy js as my partial htmls are loaded. But my main aim is on call of a hashed url I want to call an api to get data and after the request is done render the page (on callback), but it am getting "jquery.js:9631 GET http://localhost:8080/home/stats 404 ()" when it tries to call the api.
<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>
the problem is sammy js defaults to thinking the http request was a file. so i used jquery ajax instead and it worked.