Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
On page load the javascript functions called successfully, but when the page postback with the ajax the javascript didn't called again.

Thanks!
Posted
Comments
Sandeep Mewara 29-Nov-10 3:44am    
Share some code... as such on AJAX postback if you want to call javascript then call it explicitly.

When an AJAX call returns it does not cause the page load event to fire as all that is happening is that some information has been retrieved in the background and a part of the page is updated this is not a page reload.

If you want the javascript function to be called again once the AJAX call has completed you need to put a call to the original javascript function in the function that handles the javascript response either through a direct call or use the setTimeout[^] function to delay the call slightly which is a better option.
 
Share this answer
 
You need to call the Javascript function explicitely, after the call.
For that if you are initiating Ajax call from JS function, the you need to call your function after recieving the response from server.
Or
If you are using Updatepanel, the you can register your function as startupscript block as
ScriptManager.RegisterStartupScript(this.Page, typeof(System.Web.UI.Page), "StartupScript", "<script type='text/javascript' language='javascript'>javascript:yourfunction()</script>", false);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900