【发布时间】:2014-12-11 07:45:07
【问题描述】:
我是 AngularJS 的新手。我想将注册数据发布到 json 文件。发布请求工作正常,但数据未写入文件。我无法理解那个立场。我的发布请求代码有问题吗?我该如何解决?谢谢!
var regModel = {
FirstName: 'Someone',
LastName: 'Somebody',
Address: 'somewhere',
Email: 'something@gmail.com'
};
$scope.insertUser = function () {
$http.post('../DB/users.json', regModel).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
}
【问题讨论】:
标签: javascript json angularjs http