dongweng6241 2011-06-03 13:20
浏览 10
已采纳

用AJAX传递几个值?

This isn't working:

$.ajax({url: "PStoreZoomArea.php", type: "get", data: {"mapza": mapZoomArea, "mapc": mapCenter, "mapz": mapZoom}})

The code in the PHP-file:

$_SESSION['mapZoomArea'] = (isset($_GET['mapza']) ? $_GET['mapza'] : '1');
$_SESSION['mapCenter'] = (isset($_GET['mapc']) ? $_GET['mapc'] : '(55.67893946343211, 12.568359375)');
$_SESSION['mapZoom'] = (isset($_GET['mapz']) ? $_GET['mapz'] : '11');

If I only send one value it's working, but not with several. I have also tested to use a AJAX call for each value, but not working either. What could be wrong?

  • 写回答

2条回答 默认 最新

  • dongqianzong4275 2011-06-03 13:28
    关注

    If you are using GET, change your ajax block to this instead:

    $.ajax({
      url: "PStoreZoomArea.php", 
      type: "GET",
      dataType: "text",
      data: "mapza=" + mapZoomArea + "&mapc=" + mapCenter + "&mapz=" + mapZoom
    }); 
    

    Check out JQuery's official documentation on .ajax

    http://api.jquery.com/jQuery.ajax/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数