0

I am trying to show busy mask while file upload is in progress. I am using IE9. I did it following way and it is working when I am logged in. When the session is logged out the responseText is coming blank. The server is sending me below HTML but I don't see it. I check that there is login.html in response so I can redirect user to login page to relogin.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Refresh" content="1;url=login.html">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
</head>
<body>
</body>
</html>

Below is the snippet of my code,

function submitError()
{
    hideMask("mymask");
    alert("failed");
    location.reload(true);
}

function submitResponse(responseText, statusText, xhr, $form)  
{ 
    hideMask("mymask");
    alert(responseText);
    alert("success");
    location.reload(true);
}

function doSubmit()
{ 
    var options = 
    {
        error:      submitError, 
        success:    submitResponse,
        url:        'url'
    }; 

    showMask("mymask");

    $('#frmInstall').ajaxForm(options); 
}

function isFileSelected()
{
    if(document.getElementById("inputFile").value == "")
    {
        alert("Please select a file.");
        return false;
    }
}

<form id="myForm" method="post" enctype="multipart/form-data" onsubmit="return doSubmit();">
    <input type="file" name="inputFile" id="inputFile" size="30" />
    <input type="hidden" name="data" id="data" value="1.0" />
    <input type="submit" id="btnSubmit" value="Submit" onclick="return isFileSelected();" />
</form>

I really appreciate your guidance in resolving this?

Thanks, Jdp

4

1 回答 1

0

我通过在 responseXML.documentElement.innerHTML 中搜索 login.html 来解决它。

于 2013-09-05T18:19:41.537 回答