Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I want to handle timeout error on ajax call where i have set session timeout to 1 minute like..
XML
<authentication mode="Forms">
        <forms loginUrl="~/User/Login"  timeout="1" />
    </authentication>

and my call for every ajax request is like..
$.ajax({

            url: '../Document/getData?did=' + docid2,

            beforeSend: function () {

                $("#DialogData").empty().html('<p class="Loadimg"></p>');
            },
            success: function (result) {

                $("#DialogData").load('../Document/getData?did=' + docid2);
            },

            error: function (req, status, xhr) {
                alert(xhr);
                //for Timeout Error
                if (status == "timeout") {

                    $("#DialogData").empty().html('<p>Plese Try Again</p><');
                }


                if (status == "error") {
                    //for Page Not Found Invalid URL
                    if (xhr == "Not Found") {
                        
                    }
                    //for server error which is from controller
                    if (xhr == "Internal Server Error") {
                        
                    }
                } //if error
            } //error
        }); //Ajax

but on timeout i get internal server error...i want to handle timeout error differently than other error so what should i do..
Posted
Comments
sahabiswarup 19-Jan-12 5:30am    
good question
zyck 4-Feb-12 12:49pm    
great question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900