How to do a redirect to another page after successful form submission with js?

0 like 0 dislike
19 views
There is a form in which there is a field validation e-mail and telephone. After checking the validity of fields the form is submitted, and you only need to go to another page. Here is the script :

$("form").submit(function() { if ( /* both fields are valid*/) { window.location.href = "https://google.com"; return true; } else return false; });


Transition to another page occurs. You need to use ajax ?
by | 19 views

2 Answers

0 like 0 dislike
Hemorrhoids,easier through PHP POST-om to send to another page,and it will be made her transition.
by
0 like 0 dislike
Better using php
}else { header( 'Location: /user.php?uid=here is where to send... if correct or not correct, if the correct field is' making the delay with a desired time, for example 200 seconds, true, 303 ); } ;
Why using php for security sake.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
28,742 users