jQuery $.post fails in Chrome with data not empty. NETWORK_ERR: XMLHttpRequest Exception 101
Here is the code:
$.ajaxSetup({async:false});
$.post('/save/', {a : '1'}, function(res){
$('#random').html(res);
}, 'text'
).error(function(jqxhr, status, err){
$('#random').html(err);
});
In Chrome, sometimes return "Error: NETWORK_ERR: XMLHttpRequest Exception 101", However, sometimes are OK.
If I u开发者_C百科se empty data, like
{}
[]
or
""
it always works, and in Firefox 5, it also seems to always work!
I tried different data format, like ({data: '111'})
and simply string "&a=1&b=2&c=3"
, but still the same thing.
My backend is kind of simply:
@csrf_exempt
def save(request):
if request.is_ajax():
if request.method == 'POST':
message = 'POST' + str(datetime.utcnow())
else:
message = 'GET'
else:
message = 'NOT AJAX CALL'
return HttpResponse(message)
- Webserver is Django's local development server (manange.py runserver 8000)
- My chrome is 14.0.797.0
- My jQuery is 1.6.1
- Windows XP
- Python2.5
additional info: In fiddler, the response error is:
ReadResponse() failed: The server did not return a response for this request.
精彩评论