我有這個問題,我現在無法解決的日子...這是我的代碼。我想獲得xmlhttprequest或每次點擊$(「#btnQuery」)時加載的url。 這裏發生的事情是當我點擊按鈕時,它將顯示來自服務器的jqgrid中的數據。如何獲取從服務器獲取數據的url/xmlhttprequest?
$("#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 /位置顯示爲: http://localhost/process.php?....%22:%22%22,%22Password%22:%22%22%7D
,它的響應主體simething像:
{"result":{"ID":"1C1OMk123tJqzbd"}, "time_elapsed":0}
是否有人在這裏知道如何獲得url /加載以獲取數據的xmlhttprequest?和它的反應機構?我婉在我的html身體除了我的jqGrid顯示它...有任何人誰可以幫我嗎?..請...謝謝你這麼多
不知道發生了什麼,但一些很好的安全問題在這裏介紹。 – fabrik 2011-03-16 10:34:32