title: how to force the browser to run the javascript every time it called
body: <p>Dears 
   I called a javascript function on onload body </p>
  
  <pre><code>&lt;body onload="loadLeads()"&gt;
  </code></pre>
  
  <p>This function loads a leads information from database and display it in a table. 
  The problem is when the user press on delete button to delete a lead from the table. the function runs correctly and delete the lead from the database. BUT although the deletelead function relaoad the page which calls loadLeads() on load the page which should display the new leads without the deleted one. BUT the deleted one display again! although it deleted from the database!! 
  how can I run it correctly?? 
  I should delete the cache of the browser each time to force the code runs correctly!! 
  how can I do it please? </p>
  
  <p>this is the javascript code for delete</p>
  
  <pre><code>function deleteLead(id)
  {
      var xmlhttp = new XMLHttpRequest();
       xmlhttp.onreadystatechange = function() 
          {
              if (this.readyState == 4 &amp;&amp; this.status == 200) 
              {
                  location.reload();
              }
          }
          xmlhttp.open("GET", "deletelead.php?id="+id, true);
          xmlhttp.send();
  }
  </code></pre>
  
  <p>This is the script calling in the HTML </p>
  
  <pre><code> &lt;script src="https://example.net/js/loadLeads.js?version=' + Math.floor(Math.random() * 100) + '"\&gt;&lt;\/script&gt;'"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>This is the loadleads function javascript</p>
  
  <pre><code>function loadLeads()
  {
       var xmlhttp = new XMLHttpRequest();
          xmlhttp.onreadystatechange = function() 
          {
              if (this.readyState == 4 &amp;&amp; this.status == 200) 
              {
                   LeadsInfo = JSON.parse(this.responseText);
                   LeadsInfoCount = LeadsInfo.length;
                  DrawLeadsTable();
  
              }
          }
          xmlhttp.open("GET", "LoadLeads.php", true);
          xmlhttp.send();
  }
  </code></pre>
  
  <p>This is the LoadLeads.php</p>
  
  <pre><code>&lt;?php
  
       require "conn.php";
  
  
      $SelectSQL = "SELECT * FROM leads";
      $result = $conn-&gt;query($SelectSQL);
      $ECount = $result-&gt;num_rows; 
  
      if ($ECount != 0 )
      {
  
      $FinalArr = array(); 
      $count =0;  
          while($row1 = $result-&gt;fetch_assoc())
          {
                  $id = $row1["id"];
                  $name = $row1["name"];
                  $email = $row1["email"];
                  $mob = $row1["mob"];
                  $country = $row1["country"];
                  $comefrom = $row1["comefrom"];              
                  $time = $row1["time"];
  $qulified = $row1["qulified"];  
  $landingpage = $row1["landingpage"];                
                  $myArr = array($id,$name,$email, $mob,$country,$comefrom,$time,$qulified,$landingpage);
                      $FinalArr[$count] = array(); 
                      $FinalArr[$count] = $myArr; 
                      $count++;
                      $UserData = json_encode($FinalArr,JSON_UNESCAPED_UNICODE);
          }
      }
  
  
  mysqli_close($conn);
  
  
  echo $UserData;
  ?&gt;
  </code></pre>