在jquery表单插件上设置responsetext

时间:2012-02-23 10:37:48

标签: php jquery

如何在jquery表单插件@ http://jquery.malsup.com/form/#ajaxForm

上设置responsetext
function showResponse(responseText, statusText, xhr, $form)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 

    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 

    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 

    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
} 

1 个答案:

答案 0 :(得分:1)

它来自您发布帖子请求的文件:

<form id="myForm1" action="dummy.php" method="post">
    <!-- your form -->
</form>

http://jquery.malsup.com/form/dummy.php