[RESOLVED]page do not refresh in jquery.

hi,

i want that when i click on button.button event fire but page do not refresh. 

please help me out.

thanks for the help.

$( ".abc" ).click(function() {
         location.reload(true);
});

Hope this helps

Or this with ajax 

$(document).on("click", ".abc", function(){
          location.reload(true);
});

immaduddinahmed

i want that when i click on button.button event fire but page do not refresh. 

Have you considered using UpdatePanel, if not please try using that. 

Sample Code:

  <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="updpnl" runat="server">
            <ContentTemplate>
            <%--Your other controls here--%>
               <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>

C#:

/// <summary>
        /// Handles the Click event of the Button1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            //Logic to execute on button click
            
        }

Hi immaduddinah,

For your issue ,Here are my suggestion:

First, you can use ajax to achieve the asynchronous page refresh 

http://api.jquery.com/jquery.ajax/

When you click the button,you can call the ajax to fire a request to the  server side.

Second,just like  A2H mentioned ,you can use UpdataPanel to  achieve your goal:

http://www.asp.net/AJAX/documentation/live/tutorials/IntroductionUpdatePanel.aspx
http://ajax.net-tutorials.com/controls/updatepanel-control/

 

Best Regards,

Kevin Shen.

Leave a Reply