I'm making a shop and message system within my mobile website and all works fine after i refresh it by refreshing the browser.
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.
It's only on first visiting the page that it doesnt work after jquery refresh of the page.
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)
Reloadscript that i use:
$("#ShopScriptsReload").load(" #ShopScriptsReload > *");
Php mysql:
$sql = "SELECT * FROM shop ORDER BY id DESC";
$result = $conn->query($sql);
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):
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->query($sql);
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).
Well that everything works without the need for a whole refresh.
Thank you in advance guys and girls :)