weixin_33674437 2017-03-26 18:03 采纳率: 0%
浏览 41

用Ajax发布div的文本

I want to post the content of div(text) to a php page with ajax, i have already this script which post all the input fields of the three forms

.on('actionclicked.fu.wizard' , function(e, info){
    if(info.step == 3 ) {
        var dataString = $("#form1, #form2, #form3").serialize();
        var mydiv = $('#mydiv').html();
        $.ajax({
            data: dataString + mydiv,
            type: 'POST',
            url: 'confirmation.php',
            cache: false,
            success: function(data) {
                message : 'you request was submitted'
            }
        });               
    }
})

but i need to post also the text of the div in the php page i use $mydiv =$_REQUEST['mydiv']; I can echo all the other fields but nothing return for $mydiv.

  • 写回答

2条回答 默认 最新

  • weixin_33713350 2017-03-26 18:12
    关注
    `.on('actionclicked.fu.wizard' , function(e, info){
            if(info.step == 3 ) {
               var a = $("#form1").serialize();
               var b = $("#form2").serialize();
               var c = $("#form3").serialize();
               var d = $(#mydiv).text();
               data = {};
               data['astring'] = a;
               data['bstring'] = b;
               data['cstring'] = c;
               data['ddivtext'] = d;
               $.ajax({
                   data: data,
                   type: 'POST',
                   dataType: "json",
                   url: 'confirmation.php',
                   cache: false,
                   success: function(data) {
                       message : 'you request was submitted'
                   }
               });               
            }
        })
    
    评论

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来