Originally posted by Freaki Li Cuatre
View Post
But I'm wondering if your 26 ajax calls are specific to a complex page(s) and won't be so easy to abstract without making a function which pretty much mirrors $.ajax.
Regarding out of scope, not sure it depends on how these guys have structured their js. Often the jquery libraries are bundled together and added to a layout view and accessible to views that use the layout. So not usually a problem. I've not found this to be a problem others may have different experience than me.
If your worried about conflicts with other libraries then perhaps go down the route of using namespaces.
I usually add an init: function and this is where I attach functions to events and do my page setup. It seems clean to me because In a glance I can see what's going on with the page. But I'm not a javascript guru so could be better ways to structure your code.
Leave a comment: