HTTP GET using localhost


I'm creating an application using phonegap + onsen framework that will be powered by Web Services (RestFul).

But I can not make a conversation between the two parties.

My call to the Web Service looks like this:

$http.get('http://localhost:8080/WhereToJamServer/ws/colacao/getDataAtual', {})
    .success(function(data) {
    .error(function() {

And my Web Service looks like this:


public String getDataAtual() {
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    return sdf.format(new Date());
If I change localhost to or the local IP (IPv4) of my machine does not work either.

NOTE: When I call the URL through the browser it works normally.

Any suggestions?

asked by anonymous 30.07.2015 / 03:34

2 answers



I was able to connect to my localhost only by changing my localhost URL to the IPv4 address of my Wifi .

To get this address is to open the Command Prompt windows and type ipconfig . The IPv4 that you should look for is from your Wifi ( Ethernet Ethernet Adapter ).


Before I could not because I put the IPv4 of my Ethernet Adapter Local Connection (better known as cable). I did not even care.

And best of all, you do not even need the cable to access the Web Service =)

14.10.2015 / 14:12

It may be a crossdomain problem, check the whitelist of your phonegap application, take a look at the official documentation =


If you still continue the error, here is the return of the $ http.get request, which error is included.

30.07.2015 / 13:48