[問題] 如何將jq傳陣列值到php
各位前輩好
我想將js的陣列傳給php再寫入到文字檔,
目前是用
$.each(ahead,function(index,value){
var temp = value //這裡我用一個變數接value
$.get('write.php',{'query':temp} ,function(data){});});
/*
$.ajax({type:"GET",
url:'write.php',
data:value,
async:false,
cache:false,
sucess:function(value){alert(value)}
});
});
*/
write.php語法是
<?php
$price = $_GET['query'];
$file = fopen("/store/get.txt","a+");
fwrite($file,$price);
fclose($file);
?>
可是資料一直寫不到get.txt裡面,
不知道是ajax送出的問題還是php不能這樣寫?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.127.220.21
推
12/07 21:42, , 1F
12/07 21:42, 1F
→
12/07 22:50, , 2F
12/07 22:50, 2F
→
12/07 22:50, , 3F
12/07 22:50, 3F
→
12/08 00:19, , 4F
12/08 00:19, 4F
→
12/08 00:20, , 5F
12/08 00:20, 5F
→
12/08 00:20, , 6F
12/08 00:20, 6F
→
12/08 09:53, , 7F
12/08 09:53, 7F
→
12/08 09:54, , 8F
12/08 09:54, 8F
→
12/08 10:33, , 9F
12/08 10:33, 9F
→
12/08 10:34, , 10F
12/08 10:34, 10F
※ 編輯: taurus510 來自: 140.127.220.24 (12/08 11:05)
→
12/08 11:06, , 11F
12/08 11:06, 11F
→
12/08 11:21, , 12F
12/08 11:21, 12F
→
12/08 11:22, , 13F
12/08 11:22, 13F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章