Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: jacobstr/djangoajaxevent
base: 41be5ebce9
...
head fork: jacobstr/djangoajaxevent
compare: 53c02da18d
  • 2 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
5 README.md
View
@@ -1,6 +1,9 @@
-djangoajaxevent
+Django Ajax Events
===============
Request, respond, and react to ajax data in a more uniform way.
See original ReST: https://github.com/jacobstr/djangoajaxevent/blob/master/docs/index.rst for now.
+
+This project is a couple of years old now - it may no longer work with current
+versions of Django. I'll verify that.
BIN  __init__.pyc
View
Binary file not shown
10 docs/index.rst
View
@@ -10,7 +10,7 @@ Django Ajax Event
Goal
====
- * To make it easier to make ajax **requests**, have Django **respond** with corresponding output, and **react** to this new data in your Javascript code.
+ * To make it easier to generate ajax **requests**, have Django **respond** with corresponding output, and **react** to this new data in your Javascript code.
==============
How it Works
@@ -20,11 +20,11 @@ How it Works
jQuery is used for all the javascript code and `namespaced events <http://docs.jquery.com/Namespaced_Events>`_ are utilized.
-Django Ajax Event simplifies this process by formatting standard `AjaxResponses` (basically a wrapper around HttpResponse than guarantees JSON and formatting). On the client side, a piece of javascript code monitors incoming data for these
+Django Ajax Event simplifies this process by formatting standard `AjaxResponses` (basically a wrapper around HttpResponse that guarantees JSON and formatting). On the client side, a piece of javascript code monitors incoming data for these
specially formatted responses and makes sure to trigger the appropriate events.
Events facilitate a decentralized approach: whether it's an update to comments, or a shopping cart, or message - an event will be triggered and you can update the bits and pieces of your interface that need to worry about this new information rather than
-writing a monolithic function that updates your shopping cart total, updates your shopping cart summary, flags products as 'being in your wishlist' all at the same time - each of these can be it's own widget, with it's own listener that listens for a `ItemAddedToCart` event.
+writing a large function that updates your shopping cart total, updates your shopping cart summary, flags products as 'being in your wishlist' all at the same time - each of these can be it's own widget, with it's own listener that listens for a `ItemAddedToCart` event.
See :ref:`json-sample`.
@@ -84,9 +84,7 @@ Example Javascript Code
jQuery('#cart').find('#product_id-'+product_id).find('.qty').val(ajaxEvent.payload.newQty);
});
- // Because it's an event, should you add another widget to your page that also needs to reflect cart updates,
- // you can just create another event binding that listens for the same event as in the previous example,
- // but does it's own thang with the data.
+ // You can bind multiple events to teh same response.
jQuery(document).bind('CartUpdate.django',function(ajaxEvent){
// <div id="total_value">$<span class="value"></span></div>
// ajaxEvent.payload.value is an integer
BIN  models.pyc
View
Binary file not shown
BIN  templatetags/__init__.pyc
View
Binary file not shown
BIN  templatetags/draw_message.pyc
View
Binary file not shown
BIN  tests/__init__.pyc
View
Binary file not shown
BIN  tests/tests.pyc
View
Binary file not shown
BIN  tests/urls.pyc
View
Binary file not shown
BIN  tests/views.pyc
View
Binary file not shown
BIN  urls.pyc
View
Binary file not shown
BIN  utils.pyc
View
Binary file not shown
BIN  views.pyc
View
Binary file not shown

No commit comments for this range

Something went wrong with that request. Please try again.