第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JavaScript中如何通過ajax函數(shù)發(fā)送數(shù)據(jù)

JavaScript中如何通過ajax函數(shù)發(fā)送數(shù)據(jù)

PHP
慕森王 2023-04-21 16:41:49
我正在嘗試在 php 中創(chuàng)建一個類似于 instagram 和 twitter 的 ajax 收藏夾按鈕。我的代碼似乎沒問題,我做的一切都正確,并試圖讓它以這種方式工作:PHP代碼:       $user_id = $_SESSION['active_user_id'];        extract($_POST);        extract($_GET);        if(isset($_GET['message']))        {            $id=$_GET['message'];            $q=$db->prepare("SELECT msgid,date,text            FROM messages             WHERE to_id=? and msgid=?");            $q->bindValue(1,$user_id);            $q->bindValue(2,$id);            $q->execute();            $row2=$q->fetch();            $d=$row2['date'];            $fav_questionq=$db->prepare("SELECT *            FROM messages            LEFT JOIN users            ON messages.to_id=users.id            WHERE users.id=? AND messages.msgid=?            ");            $fav_questionq->bindValue(1,$user_id);            $fav_questionq->bindValue(2,$id);            $fav_questionq->execute();            $frow=$fav_questionq->fetch();            $fquestion= $frow['text'];            $result = $db->prepare("SELECT * FROM fav_messages                                WHERE username=? AND message=?");            $result-bindValue(1,$user_id);              $result-bindValue(2,$id);                           $result->execute();        if($result->rowCount()== 1 )        {            $deletequery=$db->prepare("DELETE FROM fav_messages WHERE message=?");            $deletequery->bindValue(1,$id);            $deletequery->execute();        echo("<script>location.href = 'index.php?a=recieved';</script>");        }但我一直在控制臺中收到錯誤消息:“Uncaught TypeError: Cannot read property 'value' of undefined at ajaxfav”但我已經(jīng)修復了它,現(xiàn)在它立即轉(zhuǎn)到警報消息,但沒有任何內(nèi)容被插入到數(shù)據(jù)庫中,這意味著數(shù)據(jù)沒有被發(fā)送到 php 文件. 有人可以告訴我我能做什么嗎? ajax 調(diào)用的網(wǎng)絡選項卡如果有任何幫助或建議,我將不勝感激。調(diào)用了 php 文件,但沒有向數(shù)據(jù)庫中插入任何內(nèi)容。
查看完整描述

1 回答

?
慕工程0101907

TA貢獻1887條經(jīng)驗 獲得超5個贊

您可以使用 document.msgidform.elements['fav_message'].value

在您的 ajaxfav() 函數(shù)中獲取名稱字段值。


查看完整回答
反對 回復 2023-04-21
  • 1 回答
  • 0 關注
  • 117 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號