I'm trying to use can to invoke a simple RESTful API. Using can 2.0.4 and jquery 1.10.2, I get:
It is more than possible that I've made a giant hash of my code, but this seems a bit internal to can/jquery for that.
Update: here's the code, should've included it earlier:
- var App = can.Model({
- findAll : 'GET /api/users/user10254.demo/apps'
- });
- function getAppsforUser(userfdn) { App.findAll({}, function(apps) { //Get the Template from above var Source = document.getElementById("Handlebars-Template").textContent; //Compile the actual Template file var Template = Handlebars.compile(Source); //Generate some HTML code from the compiled Template var HTML = Template({ apps : apps.channel.item.sort(function CustomSort(a, b) { return (a.title.localeCompare(b.title)); }) }); //Replace the body section with the new code. $('#content').html(HTML); makeDivSimilar(); },function(xhr) { //Replace the body section with the new code. $('#content').html("<h1>API Call Failed</h1>".concat("<p>Fault: ").concat(xhr.responseText).concat("</p>")); }); };