2
我一直在研究如何使用AJAX來得到一個PHP文件的一些內容,但我碰到一些問題。它沒有得到數據。如何使用ajax獲取PhoneGap應用程序的數據?
這裏是我的代碼:
<script type="text/javascript" charset="utf-8">
//$(document).ready(function() {
var path = "http://website.com/php/functions.php";
$(document).bind('mobileinit', function() {
$.get(path+'?get_param=value', function (data) {
$('#pageshow').html(data);
});
$.mobile.allowCrossDomainPages = true;
});
alert(path+'?get_param=value');
//});
</script>
<div data-role="content">
<h1>Hello World</h1>
<div id="pageshow">1</div>
</div><!-- /content -->
如果我去我的瀏覽器鏈接我得到的數據。
林不知道如果
var path = "http://website.com/php/functions.php";
應該var path = "php/functions.php";
但所有文件都在同一個文件夾中的服務器
如何使這項工作任何建議嗎?
很多感謝
請問這個指'.find(「#內容「]」)',是的,你可以使用URL作爲'/ PHP/functions.php' – Rafay
好點,讓我修改對 – Patrioticcow
我認爲這是一個錯字如果它不是那麼療法Ë你走這就是問題所在 – Rafay