title: javascript&jquery: show URL parameters on load
body: <p>I'm accessing the URL parameters with javascript. Then I manipulate the DOM with jQuery Mobile. But when I access the html file with the parameter, it doesn't show. I need to refresh the page to make it work. What can I do?</p>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
      $(document).ready(function() {
      // Read a page's GET URL variables and return them as an associative array.
          function getUrlVars()
          {
              var vars = [], hash;
              var hashes = window.location.href.slice(
                                 window.location.href.indexOf('?') + 1).split('&amp;');
              for(var i = 0; i &lt; hashes.length; i++)
              {
                  hash = hashes[i].split('=');
                  vars.push(hash[0]);
                  vars[hash[0]] = hash[1];
              }
              return vars;
          }
          var vars = getUrlVars()
          console.log(vars.institutname)
          $("#tasksPage").find("h1").append(vars.institutname)
          })
      &lt;/script&gt;
  </code></pre>
  
  <h2>EDIT</h2>
  
  <p>I just noticed that NONE of the jQuery/javascript is executed.
  To be clear: I have a link to that html page with the URL parameter. But if I click on that link and the page opens, it does not execute my code. I need to refresh to make that work.</p>
  
  <p>I'm using jQuery Mobile.</p>