我有这个问题,我现在几天都无法解决......这是我的代码。我想获取每次单击 $("#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 正文中显示它...有没有人可以帮助我?..请...非常感谢