[Fiddler] Error:Content-Length mismatch: Request Header indicated 16 bytes, but client sent 0 bytes.

[Fiddler] Error:Content-Length mismatch: Request Header indicated 16 bytes, but client sent 0 bytes.

 

The error is because of do "location.reload();" after "$.ajax()".

Remove "location.reload();" will fix the issue.

 

 $.ajax({
                type: 'POST',
                url: pageUrl,
                data: JSON.stringify(parameter),
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                success: function (data) {
                    onSuccess(data);
                },
                error: function (data, success, error) {
                    alert("Error : " + error);
                }
            });

 

Another same cause error:
2299 Failed to obtain request body. System.IO.InvalidDataException The request body did not contain the specified number of bytes. Got 0, expected 19

 

So how to do refresh page after ajax:

$.ajax({
                type: 'POST',
                url: pageUrl,
                data: JSON.stringify(parameter),
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                success: function (data) {
                    onSuccess(data);
                },
                error: function (data, success, error) {
                    alert("Error : " + error);
                },
                complete: function () {
                    setTimeout(function () {
                        window.location.reload();
                    }, 1000);
                }
            });


 

你可能感兴趣的:(jquery,fiddler)