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

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

如何將參數(shù)從javascript傳遞給Ajax函數(shù)

如何將參數(shù)從javascript傳遞給Ajax函數(shù)

PHP
千萬里不及你 2022-07-02 16:49:08
你好,我需要幫助,我有這個代碼<a href="javascript:void(0);" onclick="removerow('.$row["sn"].');">     <i class="fa fa-remove" style="color: red"></i></a>我需要從onclick="removerow('.$row["sn"].')這個函數(shù)中獲取價值function removerow() {    var vpb_sn = _______.val();}
查看完整描述

1 回答

?
波斯汪

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

傳遞值:


onclick="removerow('.$row["sn"].');"

接受:


function removerow(value) 

{

    // and you can use it just like variable

    console.log(value);

}

將 var 發(fā)送到 php 文件(使用 jquery ajax):


function removerow(value) 

{

    $.ajax({

        url: 'index.php', // here path to php file

        type: 'post',  //type of a query

        data: {myVariable: value}, // data which sends into php file

        success: function (data) {

            alert('sended successfully!');

        }

    });

}

然后,在 index.php(發(fā)送數(shù)據(jù)的文件)中,我們可以使用以下命令查看我們的數(shù)據(jù):


$_POST['myVariable'];


查看完整回答
反對 回復(fù) 2022-07-02
  • 1 回答
  • 0 關(guān)注
  • 128 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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