是否可以使用 getJSON 将参数(例如 get 变量)发送到 php 文件,如果可以,该怎么做?
下面的代码不起作用,但希望它能展示我试图完成的任务。
var url = "http://www.address.com/"
$.getJSON('http://anotheraddress.com/messages.php?url=+escape(url))', function(data) {
// code here
});
最佳答案
$.getJSON接受另一个数据参数:
var url = "http://www.address.com/"
$.getJSON('http://anotheraddress.com/messages.php', { url: escape(url) }, function(data) {
// code here
});
关于jquery - 通过 getJSON 将 get 变量发送到 php 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8682022/