I have a PHP 'if' that only loads a certain JavaScript if it is applicable:
(this is from the <head>
of my page):
<?PHP if ($row['jstype'] == 'myanswer')
{
echo '<script type="text/javascript" src="js/index.js"></script>';
}
else
{
echo '';
}
?>
Now, I have checked the source on a page that it applies to and the js appears in the html. However, it is not loading. I can only assume that this is because it is not loading with enough time after getting it's instruction from the PHP. Is this a correct assumption?
And, more importantly, can anyone suggest a way of doing what I need it to do?