logo
examples Examples
  • Random machine
  • Multiply example
  • Simple Form
  • Django Forms
  • Map example
  • Flickr in place editor
  • Pagination example

dajaxproject

django+ajax

Multiply Machine!

x =

Explanation

In this example we will multiply the numbers on the inputs and we will display the result on the #result element, just by clicking on the button.

ajax.py

		from dajax.core import Dajax
		from dajaxice.decorators import dajaxice_register

		@dajaxice_register
		def multiply(request, a, b):
			dajax = Dajax()
			result = int(a) * int(b)
			dajax.assign('#result','value',str(result))
			return dajax.json()
	

html

		 x
		 =
		
		
	

JS

		function calculate(){
			Dajaxice.examples.multiply(Dajax.process,{'a':$('a').value,'b':$('b').value})
		}
	
downloads Download   documentation Documentation   bugs Bugs
mail Any issues? Join our mailing list now!
Copyright © 2010 Jorge Bastida | icons by Joseph Wain