I'm getting a 'None' value when posting an array to controller (array
posted db). What could I be doing wrong?
Here is my code
<select name="result" id="result" question="Click on the button below to
know your answer.">
<option value="my result" onclick='myFunction();'>Yes</option>
<option value="no result">No</option>
</select>
<script type="text/javascript">
function myFunction();{
var result = ["bat", "cat", "dog", "sun", "hut", "run"];
ajax('{{=URL('chat', 'synchptoms')}}' + '?result=' + result, [],
':eval');
}
</script>
controller
@auth.requires_login()
def synchptoms():
value = request.vars.result#json(request.body.read())
array = [1, 2, 3, 4, 5]
db.answers.insert(message=value)
return dict(array=json(array),value=value)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/62ea848e-0446-48a3-9b21-f2b815a5ce01%40googlegroups.com.