Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
¿Cómo puedo redirigir a la página de inicio de sesión después de registrarme en este código?

todos me ayudan :(((. aquí hay un enlace a mi código https://github.com/tranluongtiensi/registration_system

Quiero redirigir al usuario a la página de inicio de sesión después del registro, lo he intentado de muchas maneras pero no funciona. muchas gracias a todos

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Simplemente puede usar window.location.href cuando envíe su formulario de registro. Entonces su código para registerUser(...) se vería así.

 async function registerUser(event){ event.preventDefault() const username = document.getElementById('user').value const password = document.getElementById('password').value const password_confirmation = document.getElementById('password_confirmation').value const phone = document.getElementById('tel').value const result = await fetch('/register',{ method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username, password, password_confirmation, phone }) }).then((res) => res.json()) if (result.status === 'ok') { alert('success'); // on a successful signup, redirect user to the login page window.location.href = 'LINK_TO_SIGNIN_PAGE'; // exp. http://localhost/signin.html }else { alert (result.error) } }

¡Darle una oportunidad!

about 4 years ago · Juan Pablo Isaza Report

0

Debe agregar una redirección aquí a esta línea aquí

por ejemplo :

 window.location.href = 'login.html'
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!