Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Uncaught Type Reference with jquery 1.10

$
0
0
I'm trying to use can to invoke a simple RESTful API.  Using can 2.0.4 and jquery 1.10.2, I get:

  1. Uncaught TypeError: Cannot read property 'setup' of undefined VM1476:895
    1. can.Control.can.Construct._isActionVM1476:895
    2. can.Control.can.Construct.setupVM1476:863
    3. can.extend.extendVM1476:780
    4. can.ConstructVM1476:629
    5. (anonymous function)VM1476:842
    6. (anonymous function)VM1476:1092
    7. (anonymous function)VM1476:7077
    8. (anonymous function)jquery-1.10.2.min.js:4
    9. x.extend.globalEvaljquery-1.10.2.min.js:4
    10. x.ajaxSetup.converters.text scriptjquery-1.10.2.min.js:6
    11. x.ajaxTransport.send.rjquery-1.10.2.min.js:6
    12. x.ajaxTransport.sendjquery-1.10.2.min.js:6
    13. x.extend._evalUrljquery-1.10.2.min.js:6
    14. x.fn.extend.domManipjquery-1.10.2.min.js:5
    15. $.fn.domManipcan.jquery.js:426
    16. x.fn.extend.appendjquery-1.10.2.min.js:5
    17. (anonymous function)jquery-1.10.2.min.js:5
    18. x.extend.accessjquery-1.10.2.min.js:4
    19. x.fn.extend.htmljquery-1.10.2.min.js:5
    20. (anonymous function)cjsapps.html:96
    21. (anonymous function)jquery-1.10.2.min.js:4
    22. x.Callbacks.p.fireWithjquery-1.10.2.min.js:4
    23. (anonymous function)can.jquery.js:6091
    24. (anonymous function)jquery-1.10.2.min.js:4
    25. x.Callbacks.p.fireWithjquery-1.10.2.min.js:4
    26. x.ajaxTransport.send.r

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:

  1.       var App = can.Model({
  2.           findAll : 'GET /api/users/user10254.demo/apps'
  3.       });
  4. 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>")); }); };
And yes I know the userfdn parameter isn't used (that's a subject for a further question once I get this working).


Viewing all articles
Browse latest Browse all 3491

Trending Articles