title: Use Ajax to Update database with Select option instead of form with button
body: <p>I would like to use ajax to the select option  and save the data in the db, instead of using a select in a form with a button.
  This because I have one select for each row and every time I change the selected value and click the button to send the value to the DB the page get reloaded and scrolls on the top.</p>
  
  <pre><code>&lt;select class='form-control col-sm-10' id='status' name='status' &gt;
              &lt;option value='new' ". ($data['status'] == 'new'? 'selected ': '') ."&gt;New&lt;/option&gt;
              &lt;option value='progress' ". ($data['status'] == 'progress'? 'selected ': '') ."&gt;Progress&lt;/option&gt;
              &lt;option  value='wait' ". ($data['status'] == 'wait'? 'selected ': '') ."&gt;Wait&lt;/option&gt;
              &lt;option  value='deler_bestilt' ". ($data['status'] == 'deler_bestilt'? 'selected ': '') ."&gt;Deler bestilt&lt;/option&gt;
              &lt;option  value='deler_trenger' ". ($data['status'] == 'deler_trenger'? 'selected ': '') ."&gt;Deler trenger&lt;/option&gt;
              &lt;option value='done' ". ($data['status'] == 'done'? 'selected ': '') ."&gt;Izettle betalt&lt;/option&gt;
              &lt;option value='close' ". ($data['status'] == 'close'? 'selected ': '') ."&gt;Online betalt&lt;/option&gt;
              &lt;option value='cancel' ". ($data['status'] == 'cancel'? 'selected ': '') ."&gt;Cancel&lt;/option&gt;
  </code></pre>
  
  <p></p>
  
  <hr>
  
  <pre><code> &lt;td&gt; &lt;button type='submit' class='btn btn-primary btn-sm'name='update'&gt;Update&lt;/button&gt;&lt;/td&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>if (isset($_POST['update'])) {$results = $link-&gt;query("UPDATE job SET status='$_POST[status]' WHERE id='$_POST[hidden]'");}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Nm8AC.png" rel="nofollow noreferrer">Select option form</a></p>
  
  <p><a href="https://i.stack.imgur.com/yVSeh.png" rel="nofollow noreferrer">query</a></p>
  
  <p><a href="https://i.stack.imgur.com/fZiGZ.png" rel="nofollow noreferrer">solution 1</a></p>
  
  <p><a href="https://i.stack.imgur.com/35EKL.png" rel="nofollow noreferrer">solution 2</a></p>
  
  <p><a href="https://i.stack.imgur.com/cwEKU.png" rel="nofollow noreferrer">solution 3</a></p>