I am using HTML5.
I want to Call API with AJAX. but, not success to perform this. plz Help me how i Use this.
I want Implement this code PhoneGap. Plz suggest me if any issue or best logic…
<!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>
Thanks…
If you want to POST data you need to use HTTP POST not HTTP GET and also call
json.stringify()on the JSON like this: