update global.asax variable from javascript
-
Hi! I have a global variable which is initialized in Global.asax (in the Session_start event). Now I want using Javascript to update this variable and I don't know how to do that. Why I have to do that? Because I used javascript to create a small timer which, at every 10 minutes I want to increase the variable by 1. Can anyone help me please?
-
Hi! I have a global variable which is initialized in Global.asax (in the Session_start event). Now I want using Javascript to update this variable and I don't know how to do that. Why I have to do that? Because I used javascript to create a small timer which, at every 10 minutes I want to increase the variable by 1. Can anyone help me please?
Hi Munteanu, Create a page or a web service to increase your value. Use AJAX request to call the page/web service. For the web service you can use generated proxy javascript classes to call it. For the page you can use for example jquery to call it. http://docs.jquery.com/Ajax
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
-
Hi Munteanu, Create a page or a web service to increase your value. Use AJAX request to call the page/web service. For the web service you can use generated proxy javascript classes to call it. For the page you can use for example jquery to call it. http://docs.jquery.com/Ajax
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
Can you give me an example please? (with some code)
-
Can you give me an example please? (with some code)
Hi, just create ASP.NET page. On
page_load
increment your value.public partial class my_page : System.Web.UI.Page {
protected void Page\_Load(object sender, EventArgs e) { // increment your value } }
from the JavaScript call your page:
$.get('my_page.aspx');
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
-
Hi, just create ASP.NET page. On
page_load
increment your value.public partial class my_page : System.Web.UI.Page {
protected void Page\_Load(object sender, EventArgs e) { // increment your value } }
from the JavaScript call your page:
$.get('my_page.aspx');
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
Are you sure this is the correct way to call the page in javascript: "$.get('my_page.aspx');"? I've tried and it's not working...
-
Are you sure this is the correct way to call the page in javascript: "$.get('my_page.aspx');"? I've tried and it's not working...
yes :) you have to download the jQuery library and add the script reference to it. It's just one file. Here: jQuery mini[^]
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
-
yes :) you have to download the jQuery library and add the script reference to it. It's just one file. Here: jQuery mini[^]
Petr Pechovic my latest articles: Web Page Loading in Steps - ASP.NET Solution[^] Buttons, Message Box and Confirm Box in ASP.NET 3.5[^]
And how do I add the script reference and where should I put the file?
-
And how do I add the script reference and where should I put the file?
I've done it! Thanks a lot for your time and help!