0

这是我的看法:

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(r'^test$', 'www.views.dummy_method', name='home'),
4

0 回答 0