title: MYSQL AJAX submit form without leave page
body: <p>So here is my scripts:</p>
  
  <p>my Ajax:</p>
  
  <pre><code>$('#ether-wallet').submit(function (e) {
      e.preventDefault();
      var name = $('#etherwallet').val();
      var dataString = 'name=' + name;
      $.ajax({
          type: 'POST',
          data: dataString,
          url: 'Database/wallet.inc.php',
          success: function (data) {
              alert(data);
          }
      });
  });
  </code></pre>
  
  <p>and I am trying to submit the form without leaving the page,
  Here is my PHP:</p>
  
  <pre><code>    &lt;form id="ether-wallet" class="wallet-form" method="POST"&gt;
          &lt;span class="span"&gt;Ether Wallet:  &lt;/span&gt;
          &lt;input type="text" name="etherwallet" placeholder="Press to lock" id="etherwallet" class="inputapi" value=""/&gt;
          &lt;button id="etherlock" class="lockbutton" type="submit" name="etherlock"&gt;Lock&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>and here's where I want to send the data</p>
  
  <p>all of this is inside the php </p>
  
  <p></p>
  
  <p>session_start();</p>
  
  <p>if(isset($_POST['ether-wallet'])) {</p>
  
  <pre><code>include_once 'dhb.inc.php';
  
  $etherwallet = mysqli_real_escape_string($conn, $_POST['name']);
  $idbridge1 = mysqli_real_escape_string($conn, $_SESSION['u_id']);
  if (empty($etherwallet)) {
      header("Location: ../signup.php?signup=success1");
      exit();
  } else {
      if (strlen($etherwallet) != 42 ) {
          header("Location: ../signup.php?signup=success2");
          exit();
      } else {
          $sql = "UPDATE users SET eth_wallet = '$etherwallet' WHERE user_id = '$idbridge1'";
          mysqli_query($conn, $sql);
          header("Location: ../signup.php?signup=success3");
          exit();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks for the help boys!!</p>