weixin_33725722 2016-06-18 10:37 采纳率: 0%
浏览 24

Ajax响应冲突CSS

I am displaying two functions in Modal head and Modal body using ajax. Before sending ajax request the modal looks like this

enter image description here

After ajax response the modal looks like this

enter image description here

Where is the issue?

Cart.php

include('includes/Cart_code.php');

    <?php

    if (isset($_POST['ID'])) {
        $cart_class = new cart_class($_POST['ID']);
        $cart_class->cart_head_info_print();
        $cart_class->cart_body_info_print();
        exit();
       }
    ?>

<script type="text/javascript">

    $(document).ready(function(){
            $.ajax({
                type: "POST",
                url: "Cart.php",
                data: {"ID":id},
                success: function(result){
                    $('#ajaxResult').html(result);

                }
            });
        });
</script>

      <!-- Modal -->
      <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">

          <!-- Modal content-->
          <div class="modal-content">
          <img src="" class="showPic">
            <div id="ajaxResult">
            <div class="modal-header" style="padding:35px 50px;">

              <button type="button" class="close" data-dismiss="modal">&times;</button>  
              <!---HERE HEADER DATA WILL BE DISPLAY---->

            </div>
            <div class="modal-body" style="padding:40px 50px;">
                <!---HERE BODY DATA WILL BE DISPLAY---->
            </div>
           </div>
        </div>
      </div> 
    </div>
  • 写回答

1条回答 默认 最新

  • ??yy 2016-06-18 11:47
    关注

    Please the take product name from ajax response and append to the header part like below,

    success:function(data){
    
       if(!data){$('#ajaxResult .modal-header').append(data);}    
    
    }
    

    as the same append into corresponding div for description and all.

    REF: How to return PHP variables on success AJAX/jQuery POST

    Hope you will found the answer here.!!

    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵