Ajax POST和PhoneGap

I created a restful webservice, when I use Postman to send Json data via POST it works fine, but as soon as I'm trying to send something via ajax POST from my Phonegap page, the url of the Phonegap page somehow gets attached to the url defined below:

<script>
    $(document).ready(function(){  
        $('#submit').click(function(){  
            $.ajax({  
                url:"http://localhost:8080/rest/user/",  
                type:'post',
                data : {
                    "id": 4,
                    "firstname": "Max",
                    "lastname": "Mustermann"
                },      
                dataType: 'JSON', 
                success: function(res, status, xhr){
                    console.log(res);
                } 
            });  
        });  
    });      
</script>

Looking at the POST method in the Firefox console the url suddenly looks like this:

http://192.168.1.102:3000/proxy/http://localhost:8080/rest/user/

Why does this happen and how can I prevent this behaviour?

Thanks in advance!

EDIT: When replacing localhost with the actual IP address the url in the Firefox console looks correct, but somehow it still doesn't work...

I think you have turned on any VPN service or proxy server. That's why url is passing through your proxy address 192.168.1.102:3000/proxy

It's working now:

  1. Replaced localhost with the actual IP
  2. Enabled CORS like described here: https://spring.io/blog/2015/06/08/cors-support-in-spring-framework
  3. Used JSON.stringify for my data