Reputation: 108
My model has a url property defined.
However, when I try to call fetch or save on it, I get the error:
TypeError: Cannot call method 'ajax' of undefined
Any solutions are appreciated.
My backend is only a simple RESTful interface.
Upvotes: 0
Views: 398
Reputation: 4173
You can do this by including jquery or zepto, but you must remember to include one of these before backbone. The other solution that doesn't force your files to be ordered is to call setDomLibrary
at document ready:
Backbone.setDomLibrary(jQuery);
This will bind Backbone to the dom library of your choice.
Upvotes: 0
Reputation: 111032
You have forgoten to add jquery or zepto.js to your side. Backbone tries to call $.ajax(params);
and $
is undefined.
Upvotes: 2