Reputation: 10061
How can I use JavaScript to display one of two different layouts based on a JS conditional?
For example, I am using the uStream API to check if a particular channel is live. If it is, then I want one layout to be displayed, if it's not live then another layout would be displayed.
Might look a little like this:
function decideLayout(responseJson){
var response = jQuery.parseJSON(responseJson);
if(response.results == "live")
{
SHOW LIVE LAYOUT
} else {
SHOW OTHER LAYOUT
}
}
EDIT: The only part of the site that needs to be dynamic is below the header. Maybe I could use php includes inside the conditional?
Upvotes: 1
Views: 190
Reputation: 22721
There are many different angles you could take, but you have only 2 real options.
Upvotes: 3