From 7ccc1b2cf04b2a3dc44240d5a7df376125aef96f Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 14 Nov 2012 23:35:30 +0000 Subject: [PATCH] Test --- Site5/Pages/v5/Init/Default.aspx | 51 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/Site5/Pages/v5/Init/Default.aspx b/Site5/Pages/v5/Init/Default.aspx index 23406874..ef366d91 100644 --- a/Site5/Pages/v5/Init/Default.aspx +++ b/Site5/Pages/v5/Init/Default.aspx @@ -96,6 +96,8 @@ } else { // Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds. + alert('setting first timeout function'); + setTimeout('recheckConfigurationWritability();', 5000); // 5s until first re-check } } @@ -131,29 +133,36 @@ return isValid; } - function recheckConfigurationWritability() { - $.ajax({ - type: "POST", - url: "Default.aspx/IsConfigurationFileWritable", - data: "{}", - contentType: "application/json; charset=utf-8", - dataType: "json", - async: false, // blocks until function returns - race conditions otherwise - success: function (msg) { - if (msg.d == true) { - // Yes, config is writable. Hide "unwritable" div, show "writable" div, all is nice - $('#DivDatabaseUnwritable').slideUp('fast').fadeOut('fast'); - $('#DivDatabaseWritable').fadeIn('fast'); - } else { - // Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds. - - setTimeout('recheckConfigurationWritability();', 2000); // 5s until first re-check - } - } - }); - } }); + function recheckConfigurationWritability() { + + alert('In timeout function'); + + $.ajax({ + type: "POST", + url: "Default.aspx/IsConfigurationFileWritable", + data: "{}", + contentType: "application/json; charset=utf-8", + dataType: "json", + async: false, // blocks until function returns - race conditions otherwise + success: function (msg) { + if (msg.d == true) { + + alert('yes, writable'); + + // Yes, config is writable. Hide "unwritable" div, show "writable" div, all is nice + $('#DivDatabaseUnwritable').slideUp('fast').fadeOut('fast'); + $('#DivDatabaseWritable').fadeIn('fast'); + } else { + // Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds. + + setTimeout('recheckConfigurationWritability();', 2000); + } + } + }); + } +