我想發送一個JSON對象到我的web服務,它在請求數據中期待JSON。 這是我POST
呼叫從angularJSAngular JS POST請求不發送數據
$http({method: 'POST',
url: 'update.htm',
data: $.param($scope.cover),
headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
}).success(function (data) {
// handle
});
價值覆蓋對象
$scope.cover = {id:1, bean:{id:2}}
蔭越來越500 (InvalidPropertyException: Invalid property 'bean[id]' of bean class [BookBean]: Property referenced in indexed property path 'bean[id]' is neither an array nor a List nor a Map;)
在網絡上,我們以這種方式發送
bean[id]:1
我認爲它應該像
發送bean.id:1
如何解決此問題。在此先感謝
爲什麼要使用$ .PARAM如果你要發送的JSON數據? – BKM