drf97973 2014-01-31 12:57
浏览 37

jquery.form获取纯HTML

I am trying to get plain HTML as response in the plugin jquery.form.js (http://malsup.com/jquery/form/), but I can't get it. So my code looks like that:

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>';

And for some reason this is changing the target wrong, take a look at the code...

if (empty($_POST)) {
...... // I get this code as output
}
else{
print "this should be the output via ajax";
}

So the questions are:

How to get the plain HTML in the complete function (responseText returns object)

How to fix the post parameters that i'm sending through ajax ?

  • 写回答

3条回答 默认 最新

  • dousheng3364 2014-01-31 13:03
    关注

    You can also append your response text/html object to some HTML entities, example

    $('#my_id').html(responseText);
    
    <div id='my_id'></div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?