2017-07-17 58 views
-2

请求URL:http://10.24.120.110/mirrortin2/api/public/2ndlayer/search/[object%20Object],[object%20Object]/brandname/barcode/gender/producttype/productname
请求方法:POST
状态代码:200 OK
我有我的网络上的这个错误,有人可以帮我这个

这是我的功能
要求[对象%20Object]

$scope.sid="scpid"; 
$scope.sid = [{todoText:'Clean House', done:false}]; 

$scope.todoAdd = function() { 
    var todoInput =""; 
    $scope.sid.push({todoText:$scope.todoInput, done:false}); 
    $scope.todoInput = ""; 
    console.log(todoInput); 
}; 

$scope.remove = function() { 
    var oldList = $scope.sid; 
    $scope.sid = []; 
    angular.forEach(oldList, function(x) { 
     if (!x.done) $scope.sid.push(x); 
    }); 
}; 

服务

function filter2ndSearch(sid, bname, bcode, gnder, ptype, pname, size_oz, size_ml, size_g, size_pcs){ 
    return $http({ 
     method: 'post', 
     url: rootURL + '/2ndlayer/search/' + sid + '/' + bname + '/' + bcode + '/' + gnder + '/' + ptype + '/' + pname ,   
     headers: { 
      'Content-Type': 'application/x-www-form-urlencoded' 
     } 
    }); 
} 
+2

'sid'和'bname'都是对象。您需要将它们串行化,而不是连接它们。 –

+0

200 OK表示一切都很好,正在运行,问题是什么? –

+0

嗨@rory我应该修改哪些代码? –

回答

0

我知道你的sid对象结构,并将它添加到URL中,bname的情况也是如此,bname的属性是什么?

url: rootURL + rootURL + '/2ndlayer/search/' + sid.todoInput + '/' + bname + '/' + bcode + '/' + gnder + '/' + ptype + '/' + pname , 
0

角提供服务作为httpParamSerializerJQLike自1.4至发送后的数据“内容类型”:“应用程序/ x WWW的形式进行了urlencoded”。 你可以做这样的 -

$http({ 
url: 'url', 
method: 'POST', 
data: $httpParamSerializerJQLike(data), // Make sure to inject the 
service in to the controller 
headers: { 
'Content-Type': 'application/x-www-form-urlencoded' // header 
} 
}).then(function(response) { /* do something here */ }); 

要知道它在细节,你可以参考这个 - URL-Encoding