Let's say I have:
<body class="hello">
How can we do something like the following?
if($("body").hasClass("hello")) {
  <script src="/demo_js/ion.rangeSlider.min.js"></script>
}
I was wondering if maybe doing something like:
if($("body").hasClass("hello")) {
 document.write('<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></'+'script>');
}
That looks fine but it's a mixup of jQuery and JS and I am not sure if that's the correct way anyway. 
It'd be even better if this could be done via the backend in php but I am not sure how to check if an element has a class in php neither how to tell it to include a script if it does. 
How would you approach it?
One trick in php I thought is the following but then again, is there any better way? 
<?php
  $hello = "hello";
  if($hello) { ?>
    <script...
<?php } ?>
<body class="<?php echo $hello; ?>">
 
    