I have an ajax plugin with a load of ajax files from a tag. When user clicks on it I don't see it to redirecting to the other page. Although we stop redirecting page using events like:
$(button).click(function (e) {
e.preventDefault();
})
I want a function that stop page from redirecting without events.
function functionName() {
functiontostopredirect(); // I need a function like this.
}
You can return false
from that function:
function functionName() {
return functiontostopredirect(); // i need a function like this.
}
functiontostopredirect(){ return false;}
添加 return false ,onclick 按钮:
<button type="submit" onclick="return false;">Submit</button>
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.