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'];
- 1 回答
- 0 關(guān)注
- 128 瀏覽
添加回答
舉報