title: Jquery reloads mysql insert only after first hard refresh
body: <p>I'm making a shop and message system within my mobile website and all works fine after i refresh it by refreshing the browser.</p>
  
  <p>My problem is when i refresh the message page and go to my shop page it loads in the php mysql script but if i than change a filter for the shop and reload the content with jquery it doesn't show up. If i refresh the whole page and try to change filters for the shop after that it all works like a charm.</p>
  
  <p>It's only on first visiting the page that it doesnt work after jquery refresh of the page.</p>
  
  <p>I've tried multiple reload div scripts with jquery but al gave the same problem. I've also tried echoing test within my scripts part. It echos only when the rest is also working (So all of the php within the reloaded divs just disappear)</p>
  
  <p>Reloadscript that i use:</p>
  
  <pre><code>$("#ShopScriptsReload").load(" #ShopScriptsReload &gt; *");
  </code></pre>
  
  <p>Php mysql:</p>
  
  <pre><code>$sql = "SELECT * FROM shop ORDER BY id DESC";
  $result = $conn-&gt;query($sql);
  </code></pre>
  
  <p>And i work with cookies to change the filter. So a cookies is set with javascript and it translate to (little edit: the cookie is set with variables that are hardcoded in):</p>
  
  <pre><code>if (empty($_COOKIE["setFilterCookie"])){$_COOKIE["setFilterCookie"]="1";}
      $fltr = $_COOKIE["setFilterCookie"];
      if ((empty($fltr) or ($fltr == 1)))
      {$WhereFltr = "";}
      elseif ($fltr == 2)
      {$WhereFltr = "WHERE tag='digitaal'";}
      elseif ($fltr == 3)
      {$WhereFltr = "WHERE tag='pins'";}
      elseif ($fltr == 4)
      {$WhereFltr = "WHERE tag='fysiek'";}
  $sql = "SELECT * FROM shop WHERE filter='$fltr' ORDER BY id DESC";
  $result = $conn-&gt;query($sql);
  </code></pre>
  
  <p>I've already tried the following methods: Removing previous pages from dom, Delete cache, tried to remove the reload part and work with GET method (this works perfectly but it is not what i want). </p>
  
  <p>Well that everything works without the need for a whole refresh.</p>
  
  <p>Thank you in advance guys and girls :)</p>