title: bootstrap-table (wenzhixin) --> Data by Ajax
body: <p>i want to use the bootstrap-table library from wenzhixin (<a href="http://bootstrap-table.wenzhixin.net.cn/" rel="nofollow noreferrer">http://bootstrap-table.wenzhixin.net.cn/</a>) but my skills seem not be as good enough that i can get the script running.</p>
  
  <p>I want the table to be supplied with data via ajax.</p>
  
  <p>Here's the code which works (example from the source page):</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;
      &lt;title&gt;SL Time&lt;/title&gt;
      &lt;!-- Bootstrap --&gt;
      &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
      &lt;!-- Bootstrap Table --&gt;
      &lt;link href="css/bootstrap-table.css" rel="stylesheet"&gt;
  
      &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
      &lt;script src="js/jquery-3.1.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;!-- Bootstrap Table --&gt;
      &lt;script src="js/bootstrap-table.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap-table-de-DE.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="container"&gt;
      &lt;table id="table"
             data-toggle="table"
             data-height="460"
             data-search="true"
             data-ajax="ajaxRequest"
             data-side-pagination="server"
             data-pagination="true"&gt;
          &lt;thead&gt;
          &lt;tr&gt;
              &lt;th data-field="nummer"&gt;Nummer&lt;/th&gt;
              &lt;th data-field="name"&gt;Name&lt;/th&gt;
          &lt;/tr&gt;
          &lt;/thead&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;script&gt;
  // your custom ajax request here
  function ajaxRequest(params) {
      // data you need
      console.log(params.data);
      // just use setTimeout
      setTimeout(function () {
          params.success({
              total: 100,
              rows: [{
                  "nummer": 0,
                  "name": "Item 0",
              }]
          });
      }, 1000);
  }
  </code></pre>
  
  <p></p>
  
  <p>
     </p>
  
  <p>But i want the data coming from my page "ajax_loader.php" which looks like this:</p>
  
  <pre><code>&lt;?php
  $data=array();
  array_push($data, array('nummer' =&gt; '1', 'name' =&gt; 'daniel'));
  array_push($data, array('nummer' =&gt; '2', 'name' =&gt; 'thomas'));
  echo json_encode($data);
  ?&gt;
  </code></pre>
  
  <p>But how do i get the following piece of code get to fill the table (as the sample function does):</p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "ajax_loader.php",
          data: "user-id=1",
          success: function(data) {
              // At this position my knowledge ends ;-(
          }
      });
  </code></pre>
  
  <p>Can anyone help me, get the thing working?</p>
  
  <p>Best regards</p>
  
  <p>Daniel</p>