Dajax is an easy to use ajax library for django inspired in xajax.
- Official Site = http://www.dajaxproject.com
- Intallation Steps = http://code.google.com/p/dajaxproject/wiki/Installation
- Available Settings = http://code.google.com/p/dajaxproject/wiki/DajaxAvailableSettings
NOTICE: From Dajax-0.7.2.0 Django-1.0 or newest is required.
Usage
Once installed you need to create ajax functions in your python code Ej:
def assign_test(request):
dajax = Dajax()
dajax.assign('#block01 li','innerHTML','Something else...')
return dajaxThis function will assign to every DOM element that maches '#block01 li' css selector in the innerHTML attribute the text ' Something else...'
You can call this function in your html code using (Ej):
<div onclick="Dajax.app_assign_test();">Click Here! </div>
JS Frameworks
Dajax generates atomatically it's own JS code using your desired JS Framework. We currently support three of the most important and popular.
Supported JS Frameworks
- Prototype 1.6 http://www.prototypejs.org/
- jQuery 1.3.2 http://jquery.com/
- MooTools 1.2.1 http://mootools.net/
New debug info inside development server.
API
Available methods inside yours dajax request response.
- alert(message)
- Alert with the 'message'
- assign(selector,attribute,value)
- Assign to all elements of the 'selector' the 'value' in the desired 'attribute'
- addCSSClass(selector,value)
- Assign to all elements of the 'selector' the 'value' css classes
- removeCSSClass(selector,value)
- Remove to all elements of the 'selector' the 'value' css classes
- append(selector,attribute,value)
- Append to all elements of the selector the 'value' in the desired 'attribute'
- prepend(selector,attribute,value)
- Prepend to all elements of the selector the 'value' in the desired 'attribute'
- clear(selector,attribute)
- Clears all elements of the 'selector' the desired 'attribute'
- redirect(url,delay=0)
- Redirect current page to url in delay ms
- script(code)
- Executes 'code' in the browser.
- remove(selector)
- Remove all elements that maches the 'selector'
- addData(data,callback_function)
- Send 'data' to the browser an call the 'callback_function' with that 'data'