Closed arafiq closed 12 years ago
I figured this out days ago. There was an issue with my use of selectors ( # ) while calling the dajax function from the template.
I have the same problem after upgrading to the latest versions of Django, Dajax and Dajaxice. I don't understand your solution.
<input type="text" name="employeeid" id="employeeid" value="" placeholder=Employee onblur="Dajaxice.projects.employeeSearch(Dajax.process,{'employeeid':$('employeeid').val()});
On the above line notice: {'employeeid':$( 'employeeid' ).val()}); [ No # employeeid]
it should be: {'employeeid':$(' #employeeid ').val()});
Ok. Thank you. I don't know why, but I just tried the same code without modification and works. Sorry for waste your time.
Hey,
So when I use mootools, dojo or prototype I get no errors while using dajax( I currently use 0.5.2v dajaxice,0.9.2v dajax, 1.4.1 django ). I have followed the documentation for Dajaxice and Dajax to set the project. And like I mentioned before it works with the other JS frameworks just not jquery. I have also tested it with different versions of jquery and I get the same error. I get the following error:
ERROR:django.request:Internal Server Error: /dajaxice/projects.employeeSearch/ Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, _callback_args, _callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 48, in view return self.dispatch(request, _args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/dajaxice/views.py", line 52, in dispatch response = function.call(request, *_data) File "/usr/local/lib/python2.7/dist-packages/dajaxice/core/Dajaxice.py", line 18, in call return self.function(_args, **kwargs) TypeError: employeeSearch() takes exactly 2 arguments (1 given)
This is what I am doing in my template:
ajax.py
from dajax.core import Dajax from dajaxice.decorators import dajaxice_register from projects import SearchForm @dajaxice_register def employeeSearch (request, employeeid): dajax = Dajax() result = SearchForm.search(emp) dajax.assign('#employeeid', 'value', str(result)) return dajax.json()
In my chrome browser console this is the error message I get. Dajaxice: Something went wrong. dajaxice.core.js:114
If you could illuminate what I am doing wrong I would really appreciate it.
Thanks