TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anilananda Chakrabortty
NA
425
78.6k
How to insert data into database using angularJS in asp.net
Jul 28 2017 3:25 AM
Here data is not inserting ...it showing error in the client side only....
Can any one help me ???
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="bootstrap-3.3.7/css/bootstrap.css" rel="stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller("myCntrl", function ($scope, myService) {
$scope.SaveUser = function () {
var User = {
Name: $scope.txtName,
Age: $scope.txtAge,
};
var response = myService.AddUser(User);
response.then(function (data) {
alert("User Created !");
});
}
});
app.Service("myService", function ($http) {
debugger;
this.AddUser = function (User) {
var response = $http({
method: "post",
url: "/Register/AddUser",
data: JSON.stringify(User),
dataType: "json"
});
return response;
}
});
</script>
</head>
<body ng-app="adventureModule">
<div class="col-md-4 col-md-offset-4" ng-controller="personCtrl">
<h3 class="text-center text-primary">Enter the Employee Details</h3>
<input type="text" class="form-control" placeholder="Enter name" ng-model="txtName" /><br />
<input type="text" class="form-control" placeholder="Age" ng-model="txtAge" /><br />
<input type="button" class="btn btn-primary form-control" data-ng-click="SaveUser();" value="Submit" />
</div>
</body>
</html>
Reply
Answers (
2
)
How to read a data row from Excel with more than 255 char?
how to remove textboxes on the basis of name