Click here to Skip to main content
15,559,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a result table on my views which is getting displayed what i want is after few seconds of displaying the table a ajax call is made to a controller

where i carry out cleaning of my database the table should not be affected .






What I have tried:

JavaScript
<script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.js">

</script>
<script type="text/javascript">
    var timer, delay = 100000;
    timer = setInterval(function () {
        $.ajax({
            type: 'POST',
            url: 'ShowResult/DeleteDatabase',
            success:
                function (response) {
                    console.log("Success")
                },
            error:
                function (response) {
                    console.log("failure")
                },
            });

    },delay)

</script>
Posted
Updated 17-May-16 0:31am
Comments
Zafar Sultan 17-May-16 3:29am    
And what is your question?
Himaan Singh 17-May-16 3:51am    
my question is for it to call the controller once only then the timer does not run
Himaan Singh 17-May-16 3:41am    
my question is for it to call the controller once only then the timer does not run

1 solution

Use setTimeout rather than setInterval

Window setTimeout() Method[^]
 
Share this answer
 

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