weixin_33725272 2014-04-02 11:16 采纳率: 0%
浏览 42

AJAX传递变量问题

Hi all Im trying to pass form data and an additional variable using an AJAX call as seen below:

function tempFunction(obj) {
    var data = $('form').serializeArray();
    data.push(
        {
            no: $(obj).attr('id')
        }
    );

    $.ajax({
        type: "POST",
        url: "/tempproject/main/changepage",
        data: data,
        success: function (msg) {
            alert(msg);
        }
    });
}

however in PHP when I try and call back the 'no' variable I am getting an error saying undefined index. within my php file I am trying:

$test  = $_POST['no'];
echo $test;

when clicking I receive a popup that says undefined index no.

  • 写回答

3条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥30 如何降低hdfs中datanode的JVM内存用量
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题
      • ¥15 win11如何运行geoserver
      • ¥15 审稿意见请教-用ERNIE进行小样本分类的对比实验问题