可以按照下面的写法来
app.controller("mycontroller", function ($scope, $http) { $scope.login = function () { var data = { name: "1", pwd: "1" }, transFn = function (data) { return JSON.stringify(data); }, postCfg = { headers: { ‘Content-Type‘: ‘application/x-www-form-urlencoded; charset=UTF-8‘ }, transformRequest: transFn }; $http.post(‘/api/Values/Login‘, data, postCfg).success(function (responseData) { alert(responseData); }); } })
时间: 2024-11-12 11:22:01