js、ajax提交表单,或者返回对象,数据(用于解决ajax上传附件问题)
直接提交
<script type="text/javascript">
$(document).ready(function() {
$('#myForm').ajaxForm(function() {
});
});
</script>
需返回对象,数据:
<script type="text/javascript">
$(document).ready(function() {
var options = {
dataType: 'json',
success: showResponse
};
$('#myForm').ajaxForm(options);
});
function showResponse(responseText, statusText, xhr, $form) {
alert(responseText);
}
</script>