I am using jQuery on my site and I need to make some jQuery IF statements for IF logged in DO THIS else DO THIS (For instance logging in would change the header text to 'My Account'). I don't really know how to read the DOM tree to see what element or node I would be calling. Does anyone have experience with this?
On Product Pages I currently have jQuery code starting with:
jQuery(function(){
if (typeof(global_Current_ProductCode) !="undefined")
is there something I could find on my site that is like this:
jQuery(function(){
if (typeof(global_Current_LoggedIn) !="undefined")
Here is a link to my demo site i'm trying to modify
Perhaps I can use FF or Chrome to help find what I'm looking for in the DOM, I really don't know w开发者_开发百科here to start or at least start by telling me what exactly (typeof(global_Current_ProductCode) !="undefiend") is doing??
I'm very wary about this - it sounds like you are trying to use Javascript (front-end) code for authentication logic. This is a massive security hole and you should ALWAYS use secure back-end code to authenticate your users!
If you are only concerned with manipulating DOM elements such as changing text like you say, that's easily achievable in JS but again, would be much better if the markup was generated on the server and sent to the front-end.
精彩评论