SOLVED: Error 404 when sending data with $

Hello everyone.

I have a problem that I can not solve. Well, actually I’m not sure could be. The strange thing is that everything is fine using curl.

Here my service within the controller.

$scope.signIn = function(user) {

    var url_service = "";
// user : contains the form data 
    $ + "login2", user)
        .success(function(responseData) {
            if (responseData == 'false') {
                    template: 'Error',
                    noBackdrop: true,
                    duration: 2000 
        .error(function(err) {
                template: 'Something',
                noBackdrop: true,
                duration: 2000 

By using the above code, I get the error 404 But if sending this form, everything works fine and returns me data.

curl -i -X POST -H 'Content-Type: application/json' -d '{"email": "", "clave": "12345"}'

HTTP/1.1 200 OK
Date: Thu, 18 Sep 2014 18:50:02 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.27
Access-Control-Allow-Origin: *
Vary: Accept-Encoding
Content-Length: 118
Content-Type: text/html

{"iduser":"1","status":"Dream Code xD","photo":"http:\/\/\/services_qp\/img_user\/jmc.jpg"}

There a right way to do this.

Ok, I found the solution, I had not seen examples of this type. I think I need to deepen angularjs

$ + "login2", user, {
            headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}

is all. Fixed.

1 Like

I had to install the whitelist plugin to get the APIs to call properly on my device. I also added the proper meta tags in my index.html file.

@ Sean_antony Thank you so much buddy i wasted all my day in it…and finally your solution.