How to handle jquery Ajax response if it binary large object data type.
hello all
I am using $.ajax with GET method to fetch data from server. The data is some file and i am getting binary data. In xmlHTTPRequest, I am able to set responseType to blob, but while doing same in $.ajax, the error event executes even after response is 200 and readyState is 4.
this is what i used.
$.
ajax({
type:
"GET",
url:
fileUrl,
success
:
function(
data,
jqXHR,
response){
var
blob =
data;
console.
log(
blob);
console.
log(
jqXHR);
console.
log(
response);
console.
log(((
new
Date().
getTime())-
startTime)/
1000);
},
error
:
function(
response){
console.
log(
response);
}
});