JqueryForm result in a div

33 Views Asked by At

I am using the jQuery Form plugin API to submit a form. It is submitting in the background, but how do I show this result (actionpage.php) in a div (with id posthere) as shown below.

<form id="myForm" action="actionpage.php" method="post"> 
    Name: <input type="text" name="name" /> 
     <input type="submit" value="Submit Comment" /> 
</form>
<script>
$('#myForm').ajaxForm();
</script>

<div id="posthere" ></div>
1

There are 1 best solutions below

0
Mohit Tanwani On BEST ANSWER

Please try following code.

$("#myForm").ajaxForm({
    success: function(res, status, xhr, form) {
        // This will show the direct res over here, you can format it as per your need.
        $('#posthere').html(res);
    }
});