我想在PHP中操纵JavaScript数组。可以做这样的事情吗?
$.ajax({ type: "POST", url: "tourFinderFunctions.php", data: "activitiesArray="+activities, success: function() { $("#lengthQuestion").fadeOut('slow'); } });
活动是一维数组,例如:
var activities = ['Location Zero', 'Location One', 'Location Two'];
尝试此脚本时无法完成…如何解决?
data: { activitiesArray: activities },
而已!现在您可以在PHP中访问它:
<?php $myArray = $_REQUEST['activitiesArray']; ?>