这个jQuery代码段已经在php中...如何访问jquery代码中的变量
<?php
echo'
$( "#searchButton" ).click(function() {
// location.reload();
alert(\"$folder\"); //This is causing error
});'
?>
答案 0 :(得分:0)
<?php
echo'
$( "#searchButton" ).click(function() {
alert("'.$folder.'");
});';
?>
答案 1 :(得分:0)
尝试此操作,因为echo将向警报返回一个值。
const tabIcon1 = require("../../../assets/tab/001.png");
const tabIcon2 = require("../../../assets/tab/002.png");
const tabIcon3 = require("../../../assets/tab/003.png");
const tabIcon4 = require("../../../assets/tab/004.png");
const tabIcon5 = require("../../../assets/tab/005.png");