KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a html code: <button>asd</button> <script type = "text/javascript"> $('button').click( function() { $.getJSON('/schedule/test/', function(json) { alert('json: ' + json + ' ...'); }); } ); </script> and corresponding view: def test(request): if request.method == 'GET': json = simplejson.dumps('hello world!') return HttpResponse(json, mimetype = 'application/json') The view is executed (tested using print ), json variable is initialised but no alert appears. What did I do wrong? I've already seen some docs on this ( http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback for example) but I didn't find an answer. EDIT: The problem was, that HttpResponse was not imported... Unfortunately Django gave no error about it. Everything else was correct. regards chriss
Tags (comma-separated)
Save Edits
Cancel