title: how to refresh a particular div after jquery form submission
body: <p>// My jquery for form submission</p>
  
  <pre><code>$(document).ready(function() {
  var form = $('#form1'); // contact form
  var submit = $('#submit1'); // submit button
  var alert = $('.alert1'); // alert div for show alert message
  
  // form submit event
  form.on('submit', function(e) {
      e.preventDefault(); // prevent default form submit
      // sending ajax request through jQuery
      $.ajax({
          url: 'giftcard_check.php', // form action url
          type: 'POST', // form submit method get/post
          dataType: 'html', // request type html/json/xml
          data: form.serialize(), // serialize form data 
          beforeSend: function() {
              alert.fadeOut();
              submit.html('Checking....'); // change submit button text
          },
          success: function(data) {
              alert.html(data).fadeIn(); // fade in response data
              form.trigger('reset'); // reset form
              submit.html('Apply'); // reset submit button text
          },
          error: function(e) {
              console.log(e)
          }
      });
  });
  });
  </code></pre>
  
  <p>// My form</p>
  
  <pre><code>&lt;p&gt;
     &lt;form action="" method="post" id="form1"&gt;
        &lt;input type="text" name="valuebox" placeholder="type your code" required /&gt; 
        &lt;button name="submit" class="button1" type="submit" id="submit1"&gt;Apply&lt;/button&gt;
     &lt;/form&gt;
  &lt;/p&gt;
  &lt;div class="alert1"&gt;Hello&lt;/div&gt;
  </code></pre>
  
  <p>// giftcard_check.php</p>
  
  <pre><code>include("include/dbconnection.php");
  
  dbconnect();
  
  session_start();
  
  $_SESSION['fromttl']    =   0;
  
  $valuebox   =   $_POST['valuebox'];
  
  $query      =   "SELECT * FROM db_coupon WHERE code='$valuebox' AND publish='1'";
  $result     =   mysql_query($query);
  $length     =   mysql_num_rows($result);
  $rows       =   mysql_fetch_array($result);
  $discount   =   $rows['discount'];
  
  if($length == 1)
  {
      $_SESSION['fromttl']    =   $discount;
      echo $_SESSION['fromttl'];
  }
  else
  {
      $_SESSION['fromttl']    =   0;
      echo "Invalid Gift Card!";
  }
  </code></pre>
  
  <p>My question is how to refresh a particular div (ie,</p>
  
  <pre><code> &lt;div id="show"&gt;&lt;?php echo $_SESSION['fromttl']; ?&gt;&lt;/div&gt;
  </code></pre>
  
  <p>) immediate after the form submission.</p>
  
  <p>My current result not refreshing the particular div after form submission. I don't want to refresh whole page, only a particular div. If i refresh whole page the div will be refreshed.</p>
  
  <p>Is there any solution? I am stuck here.</p>