jquery - AJAX: PHP query doesn't refresh when called -
i got page table supposed reload when click link. script works, , variable updated (i've tested that, see code), table doesn't reload new data sql query.
page
<!-- script start --> <script type='text/javascript'> function getresultat(str) { if (str == "") { document.getelementbyid("txthint").innerhtml = ""; return; } else { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("txthint").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("get","getresultat.php?klasse2="+str,true); xmlhttp.send(); } } </script> <!-- script end --> <!-- link --> <a style="cursor:pointer" onclick='javascript:getresultat("ksenior")'> ksenior </a> <!-- data inserted here --> <div id="txthint"><?php include("getresultat.php"); ?></div><br>
getresultat.php
<?php if(isset($_request['klasse2'])) { $klasse2=$_request['klasse2']; // used check if variable updates (for debuging only) echo $klasse2; $klasse2= $_request['klasse2']; } else { $klasse2="msenior"; // used check if variable updates (for debuging only) echo $klasse2; } $query = "select distinct * resultat resultat.klasse = '$klasse2' order resultat.plassering asc "; // send query crud $selection= array("plassering", "navn","lagnavn", "tid_liten"); $records_per_page=5; $newquery = $crud->paging($query,$records_per_page); $crud->dataview($newquery, $selection, $records_per_page, $sesong, $bestetid['tid_ny']); ?>
i can post crud if needed, there common mistake i'm making?
when calling page button echo in start reloads, not query.
Comments
Post a Comment