title: Run PHP script on link click without page refresh
body: <p>Ok, so I've done a style switcher in php, and I'm using it as a hidden feature on my site, which is triggered when user types "teema", and a modal box will appear on the top of the page content and displaying the available themes. </p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;&lt;a href="teema.php?teema=default" class="ajaxLink"&gt;Normaali&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="teema.php?teema=superhero" class="ajaxLink"&gt;Superhero&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="teema.php?teema=spacelab" class="ajaxLink"&gt;Spacelab&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="teema.php?teema=united" class="ajaxLink"&gt;United&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="teema.php?teema=cyborg" class="ajaxLink"&gt;Cyborg&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>However, I want to change the theme without the page refreshing so the css should load on background. Here's the teema.php:</p>
  
  <pre><code>&lt;?php
      $style = $_GET['teema'];
      setcookie("teema", $style, time()+604800);
      if(isset($_GET['js'])) {
          echo $style; 
      } 
      else{
      header("Location: ".$_SERVER['HTTP_REFERER']);  
      }
  ?&gt;
  </code></pre>
  
  <p>And the php on the index that checks the cookie: </p>
  
  <pre><code>&lt;?php 
  if(!empty($_COOKIE['teema'])) $style = $_COOKIE['teema'];
  else $style = 'default';
  ?&gt;
  &lt;link rel="stylesheet" href="css/&lt;? echo $style;?&gt;.css" id="theme"&gt;
  </code></pre>
  
  <p>How could I load the new css on the background, and fade it over to the old css using jQuery?</p>