【发布时间】:2011-07-16 11:46:22
【问题描述】:
我有几天无法解决的问题...这是我的代码。我想获取每次单击 $("#btnQuery") 时加载的 xmlhttprequest 或 url。 这里发生的事情是当我单击按钮时,它将显示来自服务器的 jqgrid 中的数据。
$("#btnQuery").click( function() {
var params = {
"ID": $("#eID3").val(),
"dataType": "data"
}
var url = 'process.php?path=' + encodeURI('project/view') + '&json=' + encodeURI(JSON.stringify(params));
$('#tblD').setGridParam({
url:url,
datatype: ajaxDataType,
});
$('#tblD').trigger('reloadGrid');
$('#firstur').append('the url: ' + url+'<br>');//the xmlhttpRequest should disply here in my html
$('#secur').append('response: ' + url+'<br>'); //the response of xmlhttpRequest should display here in my html
});
这是我的 process.php 的代码。这是我要为我的 jqgrid 获取数据的地方。
<?php
print(file_get_contents("http://localhost/" . $_GET["path"] . "?json=" . ($_GET["json"])));
?>
在 firebug 控制台中,显示的 xmlhttprequest/location 是: http://localhost/process.php?....%22:%22%22,%22Password%22:%22%22%7D
它的响应体类似于:
{"result":{"ID":"1C1OMk123tJqzbd"}, "time_elapsed":0}
这里有人知道如何获取加载以获取数据的 url/xmlhttprequest 吗?及其响应体?除了我的 jqgrid 之外,我还想在我的 html 正文中显示它...有没有人可以帮助我?...请...非常感谢
【问题讨论】:
-
不知道发生了什么,但这里提出了一些不错的安全问题。
标签: php xmlhttprequest httpresponse jqgrid-php