我正在使用HTML5。 我想用AJAX調用API。但是,這並不是成功的。 PLZ幫助我如何使用這個。 我想實現這個代碼PhoneGap。 PLZ建議我,如果我假設你的任何問題或最佳邏輯...我如何使用AJAX在服務器上發佈數據?
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.1.min.js"></script>
<script>
function loadXMLDoc()
{
alert("okey");
$.ajax({
type: 'GET',
url:'http://www.internationalprom.com/mobile/ipa.php',
data:{ft:'get',cat:'gallery',action:'top100'},
success: onsuccess,
error : onerror,
});
function onsuccess(data){
alert("success 1: "+ data);
// if got success then How i retrive Data from here?
}
function onerror(data){
alert("error 1 :"+data);
}
}
</script>
</head>
<body>
<h2>My CD Collection:</h2>
<div id="myDiv"></div>
<button type="button" onclick="loadXMLDoc()">Get my CD collection</button>
</body>
</html>
謝謝...
你您的網址添加到白名單中的PhoneGap?張貼您的日誌請 – Ocelot
@Ocelot當使PhonePhone白名單啓用,然後正常工作。感謝乾杯......! – MRT
歡迎您! – Ocelot