The following code is giving false result all the time. I think i am comparing two numeric variables. is that not so?
var request; var getfilesize; var maxdisplaysize=2097152;
request = $.ajax({
type: "HEAD",
url: getfile,
success: function () {
getfilesize = request.getResponseHeader("Content-Length");
console.log("Size is" + getfilesize+'xxx');
}
});
parseInt( getfilesize, 10 );
if ( getfilesize < maxdisplaysize ) {
$("#displayfile").load(getfile);
console.log('file size less then 2mb 2097152bytes');
} else {
$("#displayfile").append('<p>sorry large file<p>');
}
Pl advice why the if condition is always evaluating to be false?