【发布时间】:2014-01-31 12:57:26
【问题描述】:
我试图在插件 jquery.form.js (http://malsup.com/jquery/form/) 中获取纯 HTML 作为响应,但我无法得到它。所以我的代码看起来像这样:
print "$('#filter_form').ajaxForm({
target:'#ajax1',
beforeSend: function() {
console.log('Image uploading started.');
img_status.fadeOut();
img_slider.width('0%');
img_percent_text.html('0%');
},
uploadProgress: function(event, position, total, percentComplete) {
console.log('Image upload update...');
img_slider.width(percentComplete + '%');
img_percent_text.html(percentComplete + '%')
},
complete: function(responseText, statusText, xhr) {
img_slider.width('100%');
img_percent_text.html('100%')
console.log('Image uploading finished!');
img_preview.fadeOut(800);
alert(responseText);
}
});";
print "});";
print '</script>';
由于某种原因,这导致目标更改错误,请查看代码...
if (empty($_POST)) {
...... // I get this code as output
}
else{
print "this should be the output via ajax";
}
所以问题是:
如何在完整函数中获取纯HTML(responseText返回对象)
如何修复我通过 ajax 发送的 post 参数?
【问题讨论】:
-
你如何在 jsfiddle 中测试表单,我没有看到 PHP 选项
标签: javascript php jquery ajax jquery-plugins