简体   繁体   中英

Prevent this postback

I want to be able to prevent this postback without actually editing the HTML itself.

<a class="button campaign-button" id="ctl00_main_fastcheckout_FastCart_FastDiscount_lbDiscountCode" href="javascript:__doPostBack('ctl00$main$fastcheckout$FastCart$FastDiscount$lbDiscountCode','')"><span>OK</span></a>

Is there a default way of disabling postbacks perhaps on document load?

Thanks :)

You can always use return false .

OnClientClick="yourFunction(); return false;"

In js :

yourFunction(){
    //code
    return false;    
}

Try this Java script on your page

window.__doPostBack = function(eventTarget, eventArgument) {
return false;
};

But this is not the recommended way.

check out this how-does-the-dopostback-method-get-called-where-is-the-calling-method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM