通过AJAX调用加载的PHP页面是否可能
。$("#divid").load("phpfile.php");
将GET变量附加到它,
。$("#divid").load("phpfile.php?query=theman");
然后在phpfile.php
中使用$_GET['query']
访问,它应该返回theman
是的,如果你做了一个AJAX GET请求到phpfile.php?Query =theman,您可以像这样在脚本中访问Query的值:
$query = $_GET['query'];
是的,只要使用$.post()
或$.get();
第一个使用post数据。
$.post(".", { query: 'theman' } ).done(function(data) {
$('#div-to-fill').html(data);
});
这个使用get data
$.get(".", { query: 'theman' } ).done(function(data) {
$('#div-to-fill').html(data);
});