joestump / django-ajax

A simple framework for creating AJAX endpoints in Django.
http://github.com/joestump/django-ajax
BSD 3-Clause "New" or "Revised" License
260 stars 54 forks source link

JavaScript Client #7

Closed derekr closed 12 years ago

derekr commented 13 years ago

Added a basic js client designed in the fashion I assumed you were going in. Static object with support for chaining operations.

I also moved it in to a /static subdirectory so that it works with Django's staticfiles app out of the box.

derekr commented 13 years ago

What do you think of making the ajax call synchronous and having the full client call return data instead of passing in callbacks?

 var data = client.app('myapp').model('mymodel').get({ id: 1 });
gblache commented 13 years ago

I think async + callbacks are necessary. I wrote a similar client but I have yet to extract it from my app if you wanna check it out: https://gist.github.com/32f57fb763a486949838

gblache commented 13 years ago

https://github.com/grahampage/django-ajax.js

joestump commented 13 years ago

Can you guys duke it out and get back to me? I'm no JavaScript ninja. Derek, I work with Graham on a project that was the catalyst for creating django-ajax. He's been working with real-world django-ajax implementations so it'd be good to collaborate. Thanks for the contributions guys!

derekr commented 13 years ago

Right on. I feel @grahampage's implementation is more appropriate. It's simpler and feels like a jQuery plugin since you can access it in the same way ($.dajax.get(...)). Any thoughts @grahampage?

gblache commented 13 years ago

I can verify that mine is working, so that is a plus! My library does not have the chaining but I think I like it better that way. If you want you could always add the chaining stuff to my library so we can support both.

derekr commented 13 years ago

I don't see chaining as being necessary. Personally I rarely chain ajax calls.

joestump commented 12 years ago

I'm going to close this for now. I'll figure it out with Graham.