In chapter 9 there is this view that calls a controller using
getJSON.
VIEW:
<script>
var xyz;
$(function() {
$.getJSON('{{=URL(r=request,f='weekdays')}}',
function(data){ xyz=data; alert(data); });
$("body").click(function(event) {
['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
});
});
</script>
CONTROLLER:
def weekdays():
names=['Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday']
import gluon.contrib.simplejson
return gluon.contrib.simplejson.dumps(names)
def mycontroller():
# Here i would like the array to have the values:
# ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']