Jquery's $.get call does not return data in Chrome
I have a simple code as follows which make a get call to a djan开发者_如何学Pythongo backend to retrieve some string. However, the success function displays an empty string in Google Chrome. In Internet Explorer, the expected string is display.
$.get(url, function(data) {alert(data);} );
Django class:
def lookup(request):
message= "looking up"
print message
return HttpResponse("isss",mimetype="application/text")
The Ajax is definitely successful in Chrome so I dont understand why it works in IE and not in Chrome? Could it be some security issue in Chrome?
Thanks in Advance!
Your content type on your request should read 'text/plain'. This is the only part of your problem that would probably be browser based.
In addition, if your not already testing your ajax pieces in FireBug helps quite a lot. I am willing to bet FireBug would have showed you the full request/response.
精彩评论