ここに私の見解があります:
def dummy_method(request):
data = simplejson.dumps({'a': 1})
return render_to_response('test.html',data)
私のJavaScript:
var request = $.ajax({
url: "test",
type: "GET",
dataType: "json",
success: function(data) {
//Popluate combo here by unpacking the json
alert("0"); // This is the first element of the array sent by the server
}
});
私のURL:
url(r'^test$', 'www.views.dummy_method', name='home'),