I have a login system and I would like to write some HTML, but I don't want to write it within the success property of the AJAX call I make, neither I want to use document.write.
I am using node.js as backend. How could I render a pug file for example once the success has happened?
firebaseAUTH.signInWithEmailAndPassword(email, password).then(function (user) {
console.log('user has signed in with e-mail address: '+user.email+' and user ID: '+user.uid)
firebaseAUTH.currentUser.getToken(true).then(function(idToken) {
$.ajax(
{
// Send token to backend via HTTPS (JWT)
url: '/auth',
type: 'POST',
data: {token: idToken},
success: function (response){
var userID = response.userID
window.location = 'members-area/'+userID
firebaseDB.ref('/users/' + userID).once('value').then(function(snapshot) {
document.write('Industry: '+snapshot.val().industry+'<br />')
document.write('E-mail:'+snapshot.val().email+'<br />')
document.write('Company:'+snapshot.val().company+'<br />')
document.write('Phone: '+snapshot.val().phone+'<br />')
document.write('Source: '+snapshot.val().source+'<br />')
document.write('Lastname: '+snapshot.val().lastname+'<br />')
document.write('Firstname: '+snapshot.val().firstname+'<br />')
via konyv12