var settings = {
"async": true,
"crossDomain": true,
"url": 'https://example.com/something.aspx?i='<? echo urlencode($_GET['id']); ?>,
"method": "GET",
"headers": {
"cache-control": "no-cache",
}
}
这样不行,我认为串联是错误的。试了几种方法还是不行。
最佳答案
您需要将数据放在 JavaScript 字符串文字的内部。将 '
移到您要输出的额外数据之后。
关于javascript - php变量与javascript的连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38040449/