I’m making a PhoneGap android app and I currently have the app and my restful service running fine I’m just struggling to get the app to get data from the rest api. When I type into the browser the following:
<a href="http://localhost:8080/rest/index.php/api/practice/test/name/Peter/surname/Potter/format/json">http://localhost:8080/rest/index.php/api/practice/test/name/Peter/surname/Potter/format/json</a>The rest responds appropriately. Now I have the following code for the ajax call to the restful api PhoneGap:
$(document).on('pagebeforeshow','#page2',
function(){
$('#submit').click(function()
{
var name = $("#username").val();
var surname = $("#usersurname").val();
alert(name + " " + surname);
$.ajax({
type: "GET",
dataType: "json",
url: "http://localhost:8080/rest/index.php/api/practice/test/name/"+name+"/surname/"+surname,
success: function(data)
{
alert("Working");
}
});
});
});For some reason I cant get the rest api to send me the right data but I know its working 100%. I’m not to sure on how to fix this