mercredi 18 février 2015

AJAX loaded page doesn't see data from 'parent-page'

I have an HTML page (index.ejs) with tabs.



<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="first"></div>
<div role="tabpanel" class="tab-pane" id="second"></div>
</div>


and javaScript for these tabs:



$.get("firsttabpage.html", function(res, req) {
$("#first").html(res, req);
});
$.get("secondtabpage.html", function(res, req) {
$("#second").html(res, req);
});


It's Node.js here as you can see at first. And I have



app.get('/', function(req, res) {
res.render('index.ejs', {
user : req.user
});
});


for authentication. I can use



<%= user.local.email %>


on index.ejs and it's ok, but I can't use this code for secondtabpage.html or secondtabpage.html - "user" is not available here. What I do wrong?


Aucun commentaire:

Enregistrer un commentaire