开发者

Jquery's $.get call does not return data in Chrome

开发者 https://www.devze.com 2023-01-28 16:40 出处:网络
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 Intern

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消