Reputation: 1
I have created a validate function in Javascript for validation the form. Now I want to create another function redirect which is to be used as a call back function to redirect to another html page after form validation..how to do that??
Upvotes: 0
Views: 1299
Reputation: 129
you can use the location.replace() function like this -
validate(sometext, redirect)
function validate(text, callback){
//somelogic
callback("https://google.com")
}
function redirect(url) {
location.replace(url)
}
Upvotes: 1