Alert a message.
Usage Example:
from dajax.core import Dajax
def alert_example(request):
dajax = Dajax()
dajax.alert('Hello from python!')
return dajax.json()
Assign to all elements that matches with the selector as attribute` the value.
Usage Example:
from dajax.core import Dajax
def assign_example(request):
dajax = Dajax()
dajax.assign('#button', 'value', 'Click here!')
dajax.assign('div .alert', 'innerHTML', 'This email is invalid')
return dajax.json()
Assign to all elements that matches with the selector the CSS class value. value could be a string or a list of them.
Usage Example:
from dajax.core import Dajax
def add_css_example(request):
dajax = Dajax()
dajax.add_css_class('div .alert', 'red')
dajax.add_css_class('div .warning', ['big', 'yellow'])
return dajax.json()
Remove to all elements that matches with the selector the CSS class value. value could be a string or a list of them.
Usage Example:
from dajax.core import Dajax
def remove_css_example(request):
dajax = Dajax()
dajax.remove_css_class('div .message', 'big-message')
dajax.remove_css_class('div .total', ['big', 'red'])
return dajax.json()
Append to all elements that matches with the selector value to with the desired attribute.
Usage Example:
from dajax.core import Dajax
def append_example(request):
dajax = Dajax()
dajax.assign('#message', 'innerHTML', 'Last message')
return dajax.json()
Prepend to all elements that matches with the selector value to with the desired attribute.
Usage Example:
from dajax.core import Dajax
def prepend_example(request):
dajax = Dajax()
dajax.prepend('#message', 'innerHTML', 'First message')
return dajax.json()
Clear all elements that matches with the selector the desired attribute.
Usage Example:
from dajax.core import Dajax
def clear_example(request):
dajax = Dajax()
dajax.clear('#message', 'innerHTML')
return dajax.json()
Redirect current page to url with a delay of ms.
Usage Example:
from dajax.core import Dajax
def redirect_example(request):
dajax = Dajax()
dajax.redirect('http://google.com', delay=2000)
return dajax.json()
Executes code in the browser
Usage Example:
from dajax.core import Dajax
def code_example(request):
dajax = Dajax()
dajax.code('my_function();')
return dajax.json()
Remove all elements that matches selector.
Usage Example:
from dajax.core import Dajax
def code_example(request):
dajax = Dajax()
dajax.remove('.message')
return dajax.json()
Send data to the browser and call callback_function using this data.
Usage Example:
from dajax.core import Dajax
def data_example(request):
dajax = Dajax()
dajax.add_data(range(10), 'my_js_function')
return dajax.json()