All I am trying to pass data from a function to javascript
here is the function in web2py:
def getitemtags(inid):
jurisdictions = db(db.jurisdiction.aid ==
inid).select(db.jurisdiction.id, db.jurisdiction.jurisdiction,
db.jurisdiction.training, db.jurisdiction.predicted)
data = [[row.id, row.jurisdiction, row.training, row.predicted] for row
in jurisdictions]
return json.dumps(data)
In the view I have the following:
$().ready(function(){
console.log('----------- all is loaded ' + Date());
var itemtags =
jQuery.parseJSON({{=getitemtags(results.update_form.custom.dspval.id)}});
console.log(itemtags);
// all data should be here now and we can get started
});
Here is the error output :
var itemtags = jQuery.parseJSON([[403, "United States", true, null]])
Does anyone know how to cleanly pas json data to the client?
--
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].
For more options, visit https://groups.google.com/groups/opt_out.