如何从前端渲染HTML模板?

时间:2017-05-11 09:52:32

标签: javascript node.js

我有一个登录系统,我想写一些HTML,但我不想在我制作的AJAX调用的success属性中写它,我也不想使用document.write。

我使用node.js作为后端。一旦成功发生,我怎么能渲染一个哈巴狗文件呢?

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 />')

0 个答案:

没有答案
相关问题