Using Dajaxice I want to pass a parameter to a python function.
In the html file I have the following statement
<a href="#" onclick="Dajaxice.myapp.sayhello(Dajax.process,{'dir':3} )"> <i class="icon"></i></a>
and in my ajax.ps file I have the function
@dajaxice_register
def sayhello(request, dir):
print(dir)
It works fine if I remove the second argument dir in both the html and the python file, but with having dir, I get the error message "Something goes wrong".
Does anybody know what could be the issue here?
if you use Python 3.*, then in module dajaxIce make the changes file venv/lib/python3.2/site-packages/dajaxice/views.py
def safe_dict(d):
"""
Recursively clone json structure with UTF-8 dictionary keys
http://www.gossamer-threads.com/lists/python/bugs/684379
"""
if isinstance(d, dict):
return dict([(k, safe_dict(v)) for k, v in d.items()])
elif isinstance(d, list):
return [safe_dict(x) for x in d]
else:
return d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With