$(".Draggable").each(function(){
position=($(this).attr("id")+":"+$(this).attr("posX")+","+$(this).attr("posY"));
$.ajax({
url:"php/inseirt.php",
type:"GET",
data:{
id:$('#id').val(),
name:$('#name').val(),
position:position
},
success:function(msg){
alert(msg);
}
})
});
});
///////////////////////////////////////////////หน้ารับข้อมูลที่ส่งมา///////////////////////////////////////////////
<?php
include("../php/conDB.php");
?>
<?php
$id = @$_GET["id"];
$name = @$_GET["name"];
echo $position = @$_GET["position"];
/*
$sql="INSERT INTO tb_test VALUES ('$id','$name','$position')";
$obj=mysqli_query($link,$sql);
echo $obj?"Success":"Error";
*/
?>
/////////////////////////////////////ผลลัพธ์///////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////
ซึ่งค่าที่ alert($position); ออกมาตำแหน่งเป็น : BallA:98,161 กดOK BallB:95,121 กดOK BallC:91,151<---------แต่ที่ผมต้องการอยากให้ Alert ที่เดียวออกมา3ค่าเลย BallA:98,161 : BallB:95,121 : BallC:91,151 คือผมจะส่งไปลงในDatabese มันได้แค่ค่าแรก ที่เข้าไปอีก 2 ตำแหน่ง Error
ใครพอทราบช่วยแนะนำหน่อยครับ คือผมลองหลายวิธีละ ทั้งแปลงเป็น Array ก็ไม่ได้
ลบกวนท่านใดที่เก่ง(function) ajax ดูรายละเอียดค่าตรงนี้ให้หน่อย?
position=($(this).attr("id")+":"+$(this).attr("posX")+","+$(this).attr("posY"));
$.ajax({
url:"php/inseirt.php",
type:"GET",
data:{
id:$('#id').val(),
name:$('#name').val(),
position:position
},
success:function(msg){
alert(msg);
}
})
});
});
///////////////////////////////////////////////หน้ารับข้อมูลที่ส่งมา///////////////////////////////////////////////
<?php
include("../php/conDB.php");
?>
<?php
$id = @$_GET["id"];
$name = @$_GET["name"];
echo $position = @$_GET["position"];
/*
$sql="INSERT INTO tb_test VALUES ('$id','$name','$position')";
$obj=mysqli_query($link,$sql);
echo $obj?"Success":"Error";
*/
?>
/////////////////////////////////////ผลลัพธ์///////////////////////////////////////////
ซึ่งค่าที่ alert($position); ออกมาตำแหน่งเป็น : BallA:98,161 กดOK BallB:95,121 กดOK BallC:91,151<---------แต่ที่ผมต้องการอยากให้ Alert ที่เดียวออกมา3ค่าเลย BallA:98,161 : BallB:95,121 : BallC:91,151 คือผมจะส่งไปลงในDatabese มันได้แค่ค่าแรก ที่เข้าไปอีก 2 ตำแหน่ง Error
ใครพอทราบช่วยแนะนำหน่อยครับ คือผมลองหลายวิธีละ ทั้งแปลงเป็น Array ก็ไม่ได้