我想在插件jquery.form.js(http://malsup.com/jquery/form/)中獲得純HTML作爲響應,但我無法得到它。所以,我的代碼看起來像這樣:jquery.form get plain 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發送的發佈參數?
你如何在jsfiddle中測試表單,我沒有在那裏看到PHP選項 –