jquery script removal
Posted
by VictorS
on Stack Overflow
See other posts from Stack Overflow
or by VictorS
Published on 2010-03-17T21:30:57Z
Indexed on
2010/03/17
21:31 UTC
Read the original article
Hit count: 537
I am working on a page(ASP.NET 3.5) that has alert when "Save" button is pressed, i.e.this in page code behind:
Page.ClientScript.RegisterStartupScript(this.GetType(), "alertMsg", "alert('" + Message + "');", true);
So when I look at the page after sucessful save I see a script tag added:
<script type="text/javascript">
//<![CDATA[
alert('Save Sucessful.');
</script>
The problem is that there is another button that redirects to another page and on that page there is a button to jump back to this page, i.e. javascript:history.go(-1);
So if you save then go to another page and come back you see alert again. Unless there is a better way of handling this situation, I think I need to remove that script when I redirect from the page, can I do it with jQuery, i.e. on redirect button click remove above script from the page?
© Stack Overflow or respective owner