Test Ajax on live deployment

This commit is contained in:
Rick Falkvinge
2012-11-15 11:44:05 +00:00
parent 5a56c9f797
commit bf526991db
3 changed files with 37 additions and 4 deletions
+22
View File
@@ -125,9 +125,13 @@
if (isValid) {
alert('initing progressbar and data init');
$('#DivProgressDatabase').progressbar({ value: 0, max: 100 });
setTimeout('updateInitProgressBar();', 1000);
$('#<%=this.ButtonInitDatabase.ClientID %>').click();
beginInitDatabase();
}
}
@@ -162,6 +166,8 @@
function updateInitProgressBar() {
alert('updateInitProgressBar');
$.ajax({
type: "POST",
url: "Default.aspx/GetInitProgress",
@@ -180,12 +186,28 @@
} else {
// We're not done yet. Keep the progress bar on-screen and keep re-checking every two seconds.
alert('updating progressbar - ' + msg.d);
$('#DivProgressDatabase').progressbar("value", msg.d);
setTimeout('updateInitProgressBar();', 2000);
}
}
});
}
function beginInitDatabase() {
$.ajax({
type: "POST",
url: "Default.aspx/InitDatabase",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
alert('InitDatabase returned');
}
});
}
</script>
+11 -1
View File
@@ -269,12 +269,22 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page
this.TextCredentialsAdminPassword.Text)));
}
[WebMethod(true)]
public static void InitDatabase()
{
for (int loop = 0; loop <= 100; loop++)
{
HttpContext.Current.Session["PercentInitComplete"] = loop;
System.Threading.Thread.Sleep(1000);
}
}
[WebMethod(true)] // "true" causes session to be loaded
public static int GetInitProgress()
{
try
{
int progress = (int)new Random().Next(100); // (int) HttpContext.Current.Session["PercentInitComplete"];
int progress = (int) HttpContext.Current.Session["PercentInitComplete"];
return progress;
}
+4 -3
View File
@@ -97,10 +97,11 @@
padding: 0;
padding-top:3px;
padding-bottom: 3px;
border: 0px solid #E0E0E0;
float: left;
clear:both;
border: 0px solid #E0E0E0;
float: left;
clear: both;
}
/* Anchor Element Style */
.swMain ul.anchor li a {
display:block;