﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6613	XmlHttpRequests to simple views fail to return in MSIE	kevin@…	nobody	"I've been using Django for some UI prototyping work to return templates as well as data responses to XMLHttpRequests (XML, XHTML, JSON, etc.) and came across a really unusual bug.

In short, if I write a really simple view like this:

{{{
def get_json_data(request):
    """"""Returns some dummy JSON-encoded data""""""
    jsondata = build_json_data()
    return http.HttpResponse(jsondata, mimetype='text/javascript')
}}}

Then call that view via XMLHttpRequest from any version of MSIE, MSIE will report that the request has failed when clearly Django returned the data just fine (reports error code 200, and identical code works fine in Firefox).

However I found -- quite by accident, as it turns out -- that one of my views always worked in MSIE. Through process of elimination I realized the only difference: I was printing the content of request.POST to the console for debugging purposes:

{{{
def get_json_data(request):
    """"""Returns some dummy JSON-encoded data""""""
    print request.POST
    jsondata = build_json_data()
    return http.HttpResponse(jsondata, mimetype='text/javascript')
}}}

With that one extra line, MSIE accepts the response every time. This doesn't seem like a good fix for production environments -- and maybe it doesn't matter, as I haven't verified that the problem exists there -- but it certainly caused me a lot of frustrating trying to validate my code under MSIE, and wanted to save people some grief in case they have encountered similar problems."		closed	HTTP handling	dev		invalid	MSIE, XMLHttpRequest, views, Json		Unreviewed	0	0	0	0	0	0
