Stop a postback in javascript

戏子无情 提交于 2019-11-30 23:27:03

How I do it; How I've done it:

<asp:LinkButton ID="linkKB" OnClientClick="absolutizeWidth(); return false;"  runat="server">Columns too small?</asp:LinkButton>

The "return false" stops the postback of the server control after the javascript function executes. Very useful.

To stop postback in javascript, write a "return false;" statement.

But i guess i just didn't understand your question or you asked it too unclear. :)

hmmm let me try.. (i dont speak english and dont know the correct words to explain that i want but ill try :P)

i call a javascript __doPostBack BUT it takes too much to respond and stay in Loading... i want to stop the postback, something like a response.end but in javascript.

if my script takes too much to execute then call a StopPostBack or something..

thanks.

Are you trying to stop the post back after you refresh the page or after the Thickbox returns?

If you do not want to execute the postback when the user fires off an event, you can just return false within that even handler.

For example, the normal way to stop posting back during a page load is something like this:

onClick="if(SOMECONDITION != true) { return false; }" 

This will stop the postback being fired.

If a postback is already in progress and you want to try and abort it (which I think is what you are asking), you will need to "stop" the page from loading (as that's what the javascript is doing). Maybe try this:

IE: window.document.execCommand('Stop'); Other (Mozilla etc): window.stop();

I haven't tried this in a while (and it's off the top of my head), so the code may need some massaging.

If I've totally missed your question, I apologise, maybe you can clarify?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!