I have an asp: DropDown List and an onselectedindexchanged event for it.
While the onselectedindexchanged function is being processed I want to show a message "Loading Please wait....."
I am using the JQuery route to do this. Below is my code, some how it is now working quite right.
Please could somebody help me with syntax. Alsom please could you tell me when and how I could use the $.getJSON in my case. I have used it incorrectly in my code. Please correct it for me.
urpalshu
Member
50 Points
254 Posts
JQuery Processing Spinner
Jul 01, 2010 09:47 PM|LINK
Hello:
I have an asp: DropDown List and an onselectedindexchanged event for it.
While the onselectedindexchanged function is being processed I want to show a message "Loading Please wait....."
I am using the JQuery route to do this. Below is my code, some how it is now working quite right.
Please could somebody help me with syntax. Alsom please could you tell me when and how I could use the $.getJSON in my case. I have used it incorrectly in my code. Please correct it for me.
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> <script type="text/javascript"> function init() { $('#loading_county_drop_down').hide(); } window.onload = init; $(document).ready(function() { $.ajaxSetup({ beforeSend: function(req) { // Show the Loading... }, complete: function(req) { $('#loading_county_drop_down').hide(); } }); $('#<%=ddlContinents.ClientID %>').change(function() { var value = $("#number").val() $('#loading_county_drop_down').show(); $.getJSON("test.cfc?method=double&returnFormat=json", { number: value }, function(d) { //do nothing with response alert('Done with request'); }); }); }); </script> </head> <body> <form runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:DropDownList AutoPostBack="true" ID="ddlContinents" runat="server" onselectedindexchanged="ddlContinents_SelectedIndexChanged1"> <asp:ListItem Value="LA" Text="Louisiana"></asp:ListItem> <asp:ListItem Value="AK" Text="Alaska" ></asp:ListItem> <asp:ListItem Value="MD" Text="Maryland" ></asp:ListItem> </asp:DropDownList> <span id="loading_county_drop_down"> <img src="images/ajax-loading.gif" width="16" height="16" align="absmiddle"> Loading... </span> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html>protected void ddlContinents_SelectedIndexChanged1(object sender, EventArgs e) { Thread.Sleep(5000); TextBox1.Text = "Good Work!!"; }please give alternate solutions if any!
Thanks
JQueryuery Processing
sandy060583
Star
8714 Points
1624 Posts
Re: JQuery Processing Spinner
Jul 02, 2010 06:40 AM|LINK
Here is very good example :
http://www.bitrepository.com/dynamic-dependant-dropdown-list-us-states-counties.html
Hope this will help
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)