Babu
Babu

Reputation: 455

Success message is not showing in html page with ajax/jquery request

I have a feedback form which is validate by jquery and request is sent to Php page using ajax. So In firebug I checked that it's successfully showing the "Successful Message" but why it's not showing in hmtl page <div id="#feedback_result"></div> tag ?

Jquery Code:

<script>
$(document).ready(function() {  
    // validate signup form on keyup and submit
    $("#feedback").validate({
    submitHandler: function(form) {
        $.ajax({
            url: form.action,
            type: form.method,
            //async: false,
            data: $(form).serialize(),
            beforeSend : function (){
              $('input[type=submit]').attr('disabled', false); 
            },
            success: function(response) {
            $('#feedback_result').html(response);           

            }            
        });
    },
        rules: {            
            yourfeedback: "required",           
        },
        messages: {         
            yourfeedback: "Required",           
        }
    });
});
</script>

Html Code:

<div id="#feedback_result"></div>
<form id="feedback" method="post" action="<?php echo htmlspecialchars("feedback_process.php"); ?>">
<table width="400" border="0" cellspacing="5" cellpadding="0">  
  <tr>  
    <td>Your feedback</td>
  </tr>
  <tr>  
    <td><textarea class="textarea2" name="yourfeedback" placeholder="Your feedback"></textarea></td>
  </tr>
  <tr>  
    <td><input type="submit" id="submit" value="Send Feedback" name="submit" class="submit_button"/></td>    
  </tr>
</table>
</form>
</div>

Note: I've another form in this same page with same jquery/ajax code except the id $("#order").validate({

Upvotes: 0

Views: 1127

Answers (1)

Felix
Felix

Reputation: 38102

Try to remove the # from your id value:

<div id="feedback_result"></div>

Upvotes: 3

Related Questions