带有Cordova和jQuery ajax的Angular JS中的post请求的HTTP问题

时间:2015-09-17 11:01:03

标签: jquery ajax angularjs cordova http

我在使用$ http Angular的角度JavaScript网络服务中遇到了问题。

当我使用jQuery AJAX使用相同的Web服务时,上面相同的Web服务给出了正确的响应,但是当我使用$ http Angular JS使用相同的服务时,它会导致错误。

Angular JS $ http代码:

mainApp.controller('registrationCtrl', function($scope,$http) {
  $scope.registration=function(){
     console.log("registration called");

        var regEmail=$("#regEmail").val();
        var regPass=$("#passEmail").val();
       var ws_url="http://apparelinindia.com/selfiestandoff/WebServices/register";
       var data={user_email:regEmail, user_password:regPass}
       var request = $http.post(ws_url, data).then(function(response){

           console.log(response);

       }, function(response){
            console.log("error"+response);
       });


      };
});

jQuery AJAX代码:

$.ajax({
           type: "POST",
           url: "http://apparelinindia.com/selfiestandoff/WebServices/register",
           data:{user_email:reg_useremail, user_password:reg_userpass},    
           dataType: "json",
           headers: { "cache-control": "no-cache" },
           crossDomain: true,
           cache:false,
           beforeSend: function (){ 
             app.showBlur();

          },
            success: function(resData){
            var resObj =resData;
            console.log(JSON.stringify(resObj));
         },
            complete: function (){
         },
           error:function(x, t, m){

           },
     });

请找到我的控制台详细信息......

registration called
services.js:64 Object {data: Object, status: 200, config: Object, statusText: "OK"}config: Objectdata: Objecterror: Objectcode: "103"message: "Required Parameters not found"__proto__: Objectstatus: false__proto__: Objectheaders: (c)status: 200statusText: "OK"__proto__: Object

0 个答案:

没有答案