2016-07-28 5 views
0

jQueryフォームプラグインAPIを使用してフォームを送信しています。それはバックグラウンドで提出していますが、以下のようにこの結果(actionpage.php)をdiv(id postで)にどのように表示しますか?div内のJqueryFormの結果

<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> 
+0

結果を処理するには、コールバック関数を 'ajaxForm'に追加する必要があります。 http://stackoverflow.com/questions/14754619/jquery-ajax-success-callback-function-definitionを確認してください –

答えて

0

次のコードを試してください。

$("#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); 
    } 
}); 
関連する問題