backbone.js - How can i create object of 'Todo' model in b.js which is in another javascript file a.js -
in a.js
var todo = backbone.model.extend({ idattribute: "_id", defaults: { _id: '', label: '', }, });
in b.js
$(function(){ $.getscript("/js/a.js"); var obj = new todo(); });
it giving error problem not constructor
i believe getscript
asynchronous call todo
not available, resolve issue call todo
constructor in getscript
success callback:
$(function(){ $.getscript("/js/a.js", function() { var obj = new todo(); }); });
Comments
Post a Comment