0

我想將記錄更新到api。用於http的AngularJS(500內部服務器錯誤)把

在我的螢火蟲它顯示:

500 internal server error,

XML Parsing Error: no element found Location: moz-nullprincipal:{f514f16e-f3d3-49f1-99e6-105b2b80f26c} Line Number 1, Column 1:

也劃歸它表明:

There are no child objects

這裏是我的代碼

$scope.EditUser = function(){ 
    $scope.ApplicationId = '7bg67898ewnbqjq65e'; 

$http.put("mydomain.com/api/Users/UpdateUser", {}, { 
    params: { _id: $scope.selectedItem._id, ApplicationId: $scope.ApplicationId, User_Name : $scope.selectedItem.UserName, IsActive: $scope.selectedItem.IsActive } 
}); 
+0

你是否在控制服務器端代碼?你有沒有嘗試調試UpdateUser的時候被擊中? – LDJ

+0

它解決了$ http.put(「mydomain.com/api/Users/UpdateUser」,{ _id:$ scope.selectedItem._id,ApplicationId:$ scope.ApplicationId,User_Name:$ scope.selectedItem.UserName,IsActive:$ scope.selectedItem.IsActive }); – user3055606

回答

1

這是使用這個

解決
$scope.EditUser = function(){ 
    $scope.ApplicationId = '7bg67898ewnbqjq65e'; 

$http.put("mydomain.com/api/Users/UpdateUser", { 
    _id: $scope.selectedItem._id, ApplicationId: $scope.ApplicationId, User_Name : $scope.selectedItem.UserName, IsActive: $scope.selectedItem.IsActive 
}); 
1

執行PUT請求的快捷方式是:$ http.put(url,data,[config]); @ user3055606你的答案是正確的。