javascript - Change limit of sql without refreshing -


i know sort of same question has been asked before, whatever read , tried can't code work.. i'm still sort of noob , have feeling i'm doing wrong

so, right have limit of 10. want limit 50 when click button 'view more', without refreshing page.

this html:

    <?php     require_once 'php/connection.php';      include 'includes/head.php';     ?>      <body>         <?php include 'includes/header.php'; ?>          <section class="wrapper" id="projectshow">             <?php              $limit = '10';              $query = mysql_query("select * expodetails order rating desc limit $limit");             $counter = 1;             while($row = mysql_fetch_array($query)){                 $id = $row['id'];                 $projectname = $row['projectname'];              ?>             <article class="project-wrapper">                 <div class="project">                 <h3><?php echo "$projectname"; ?></h3>             </article>             <?php                 }             ?>          <a href="#" class="submit viewmore" onclick="bekijkmeer('a');">view more</a>         </section>          </body> 

this file named ajax.js:

    function check(){      var xmlhttp;       try         {         // firefox, opera 8.0+, safari         xmlhttp=new xmlhttprequest();         }       catch (e)         {         // internet explorer         try           {           xmlhttp=new activexobject("msxml2.xmlhttp");           }         catch (e)           {           try             {             xmlhttp=new activexobject("microsoft.xmlhttp");             }           catch (e)             {             alert("your browser not support ajax!");             return false;             }           }         }         return xmlhttp;     }      function bekijkmeer(x)      {       var xmlhttp = check();         xmlhttp.open("get","/expoproject/php/changelimit.php?appeltje="+x+"",true);                xmlhttp.onreadystatechange=function()               {               if(xmlhttp.readystate==4)                 {                 document.getelementbyid('topchange').innerhtml=xmlhttp.responsetext;                 }               }              xmlhttp.send(null);           } 

and file named changelimit.php:

<?php              $limit = '50';              $query = mysql_query("select * expodetails order rating desc limit $limit");             $counter = 1;             while($row = mysql_fetch_array($query)){                 $id = $row['id'];                 $projectname = $row['projectname'];              ?>             <article class="project-wrapper">                 <div class="project">                 <h3><?php echo "$projectname"; ?></h3>             </article>             <?php                 }             ?> 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -