weixin_33681778 2018-02-12 19:51 采纳率: 0%
浏览 31

PHP数组提交给ajax

I'm not sure if this question has been asked before, so please note if it's duplicate.

The top line is a PHP merged array that I'm trying to send in AJAX to another page.

I'm having trouble finding what goes in the "?" or how to format it.

<?php $_SESSION['pdfData'] = array_merge_recursive($count, $qty); ?>

$.ajax({ 
    type: "POST",
    url: "indexMenu-sm-pdf.php",
    data: { 
            ? 
        },
    dataType: "JSON", 
    success: function(data){
        console.log("Good.");
    },
        error: function(jqXHR, textStatus, errorThrown) {
        console.log(textStatus, errorThrown);
    } 
});

I understand that the built-in function json_encode() but i lack the know-how. And I've been reading about serialization. Is one better than the other?

My main questions are:
What goes into the "?" as $_Session['pdfData'] can not be sent.
And
Is there a difference is using json_encode vs. serialization for this issue?

</div>
  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 关于#sql#的问题:没有用命令关闭cdc,手动把系统表开启的cdc右键删除了
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题