[問題] 請幫忙看Get傳值語法

看板Ajax作者 (D桃)時間9年前 (2015/03/14 12:55), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串1/1
問題有點low,因為非本科, 公司網站有些問題,只好硬著頭皮上 小弟將問題簡化表示在以下網址 : study.elhomeo.com 在文字框修正數字後,要回傳一組資料給後端 stk_test1.php 但就是收不到, 看不出哪裡出問題了,只好上來請高手指教. 感謝 index.php --------------- <script type="text/javascript"> var xmlHttp; var json_object = new Object(); function upt(pid,pqty,pos,status) { var str = "stk_test1.php?action=saveqty&id=" + pid + "&qty=" + pqty + "&pos=" + pos + "&status=" + status; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } document.getElementById(pos).innerHTML= str; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { if (xmlhttp.responseText){ document.getElementById(pos).innerHTML=xmlhttp.responseText; } } } xmlhttp.open("GET",str,false); xmlhttp.send(); } </script> <body> <div id="pos1">001</div> <form action=""> <INPUT id="qty" type="text" size=6 VALUE="999" onblur="upt(\'1\',this.value,\'pos1\',\'1\')"> </form> </body> stk_test1.php ----------------- <?php if (isset($_Get['action']) && ($_Get['action'] == 'saveqty')) { $p_id = $_Get['id']; $p_qty = $_Get['qty']; $p_pos = $_Get['pos']; $p_status = $_Get['status']; $arr = 'result:'.$p_id.$p_qty.$p_pos.$p_status; echo $arr; } ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.27.4.231 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1426308904.A.929.html

03/14 13:14, , 1F
把$_Get改成$_GET(全大寫)看看
03/14 13:14, 1F

03/14 13:39, , 2F
GET
03/14 13:39, 2F

03/14 13:45, , 3F
哈哈,耍笨了,謝謝大大指教!!
03/14 13:45, 3F
文章代碼(AID): #1L0xyeaf (Ajax)