e.preventDefault() is not working
<p>The first e.preventDefault() inside the if condition is not working. Only the second e.preventDefault() is working. Any help would be greatly appreciated.</p>

<p>I made following change to the jquery, but then the form submission does not work properly and the page stops at the blank form action page checkcoupon.php instead of further processing of form.</p>

<pre><code>&lt;form name='coupon_discount' id='coupon_discount' action="checkcoupon.php" method='post'&gt;
        &lt;input type="hidden" name="user" value="&lt;?php echo $_SESSION[user_id]; ?&gt;" &gt;
        &lt;input value="" id="couponCode" name="couponcode" class="coupon-placeholder placeholder"  type="text"/&gt;               
        &lt;input type='submit' name='coupon_code_submit' value='Apply' id="cart-coupon" class="sp_apply_btn" &gt;      
  &lt;/form&gt;



     jQuery(document).ready(function(){
        jQuery('form#coupon_discount').submit(function(e){
             var   user     = jQuery('input[name="user"]', 'form#coupon_discount').val();
             var couponcode = jQuery('input[name="couponcode"]', 'form#coupon_discount').val();
             if(user != '' &amp;&amp; couponcode != '') {
             e.preventDefault();
             var URL = '&lt;?php echo $_conf_vars['ROOT_URL']."ajax.php?usercp=";?&gt;'+user+'&amp;cponcode='+couponcode;
             jQuery.ajax({
                        url:URL,
                        type:'POST',
                        async:true
                      }).done(function(msg,e){
                        if(msg=='Already used!'){ 
                          alert('Coupon code already used!');
                         }else {  
                          jQuery('form#coupon_discount').submit();  
                         }
                      }); 
                   }
                   else{
                     e.preventDefault();
                     alert('Enter a coupon code!');
                   }    
             });  
        });
</code></pre>

<p>And this the action page 'checkcoupon.php' code.</p>

<pre><code>  session_start();
    ob_start();

    include("includes/files.php");
    include("classes/class.common.php");

    if(isset($_REQUEST['coupon_code_submit']))
    {
        $obj_common = new common;
        $discount = $obj_common-&gt;getCouponCodeDiscount($_REQUEST['couponcode'],$_REQUEST['user']); 
        header("location:payment.php");
    }
</code></pre>
