title: submit the form without Page Refresh not working
body: <p>plz add my code not working </p>
  
  <p>i want user create post without refresh page on page accueil
  // code html for form (title , text)</p>
  
  <pre><code>&lt;form class="posting" method="POST" enctype="multipart/form-data"&gt; 
  
  &lt;input type="text" name="title" class="title-input" placeholder="Quelle est votre question... ?"
  autocomplete="off"&gt;
  
  &lt;textarea name="text" id="text" class="textarea" cols='60' rows='8' &gt;&lt;/textarea&gt;
  
  &lt;button class="btn-ajouter" type="submit" onclick="get()" name="ajouter" value="ajouter"&gt;ajouter&lt;/button&gt;         
  &lt;/form&gt; 
  </code></pre>
  
  <p>// code php create post (user)</p>
  
  <pre><code>if(isset($_POST['ajouter']) &amp;&amp; !empty($_POST['text']) &amp;&amp; isset($_POST['title']) )
  {
    $texte = htmlspecialchars($_POST['text']);
    $title = htmlspecialchars($_POST['title']);
  
   $stmt=$connect-&gt;prepare('INSERT INTO
  
    publications(title_post,post) VALUES(?,?) ');
  
    $stmt&gt;execute(array($texte,$title)); 
   }
  </code></pre>
  
  <p>// code display result (page accueil) (page accueil)</p>
  
  <pre><code>&lt;div id="result"&gt;
   &lt;?php 
    $stmt = $connect-&gt;query('SELECT *FROM publications ');
  
    while($row=$stmt-&gt;fetch() )
      {
        echo $row['title_post'] ; 
        echo $row['post'];
   ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>// code ajax </p>
  
  <pre><code>     function get(){
        var result ;
        if(window.XMLHttpRequest)
        result = new XMLHttpRequest();
  
        else
  
        result = new ActiveXObject('Microsoft.XMLHTTP');
  
        result.onreadystatechange = function()
         { 
        if(result.readyState == 4 &amp; result.status == 200)              
              document.getElementById('allpost').innerHTML = 
                                                        result.responseText;
         }
  
                    result.open('POST','accueil.php',false);
                    result.setRequestHeader('Content-type','application/x-www-
                     form-urlencoded');
                    result.send();
  
  
                 }
  </code></pre>