데이터 서식 문제가 있습니다. Ajax POST를 통해 PHP 함수에 전달하려는 여러 3D 배열 (stickler 배열의 배열 배열)이 있습니다. 나는이 작업은 JSON.stringify와 함께 stringifying 다음 객체로 결합과 시도했다 :아약스 POST를 통해 여러 3D 배열 전달
에 관계없이 내가 postObj 또는 postData를 내가 인덱스이 객체 인덱스의 모든 정의되지되는 오류가 발생 보내 여부var postFile = '/games/saveMap';
var postObj = {'mapTiles':mapArray,
'tileRots':rotations,
'ceilings':ceiling,
'floors':floor,
'pitDepth':depth,
'sections':sectionNames,
'mapName':$('#mapName').val()
}
var postData = JSON.stringify(postObj);
$.ajax({
type: 'POST',
url: postFile,
data: postObj,
success: function(data)
{
},
error: function(jqXHR, textStatus, errorThrown)
{
}
});
. 내 형식에 어떤 문제가 있습니까? POST에서 내 색인을 감지하는 데 필요한 형식은 무엇입니까?
편집 :
$mapName=$_POST['mapName'];
$sectionNames=$_POST['sections'];
$mapArrays=$_POST['mapTiles'];
$rotations=$_POST['tileRots'];
$ceilings=$_POST['ceilings'];
$floors=$_POST['floors'];
$pitDepth=$_POST['pitDepth'];
var postData = "mapName ="+ $ ('# mapName') .Val() + "& sections ="+ JSON.stringify (sectionNames) + "& mapTiles ="+ JSON.stringify (mapArray) + "& tileRots ="+ JSON.stringify (회전) + "& ceilings ="+ JSON.stringify (천장) + "& floors ="+ JSON.stringify (바닥) + "& pitDepth ="+ JSON.stringify (깊이); 문자열을 생성하기 위해 맵 이름을 제외하고 print_r ($ _ POST)으로 데이터를 볼 수 있지만 색인은 여전히 정의되지 않았습니다. – Rorrik