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
neeraj gandhi
1.4k
299
57.2k
post method not working with angular js and asmx page
Aug 24 2016 6:49 AM
i have created web service using
asmx page
in which has a method
[WebMethod]
public string InsertStudent(string Name, string Gender, string City)
{
operation oper = new operation();
string query = string.Empty;
try
{
oper.Trans_Begin();
query = @"SELECT MAX(ID)+1 AS ID FROM TBLSTUDENTS";
int id = Convert.ToInt32(oper.DTSET(query).Tables[0].Rows[0]["ID"].ToString());
query = string.Empty;
query = @"INSERT INTO TBLSTUDENTS VALUES('" + id + "','" + Name + "','" + Gender + "','" + City + "')";
oper.sqinsert(query);
oper.Trans_Commit();
return query;
}
catch(Exception ex)
{
oper.Trans_Rollback();
return "error";
}
}
my angular code is
$scope.Save = function () {
let name=$scope.studentname,gender=$scope.studentgender,city=$scope.studentcity;
let datalist=JSON.stringify({Name:name,Gender:gender,City:city});
$http({
url: "Student.asmx/InsertStudent",
method: "post",
headers: {
"Content-Type": "application/json; charset=utf-8",
"dataType": "json"
},
data: datalist
}).then(function (response) {
$scope.message = "Saved Sucessfully";
}), function (reason) {
$scope.message = reason.data;
}
i am getting internal server error please help
here is the example
https://groups.google.com/forum/#!topic/firebase-angular/6wLh5oAnpak
for my problem
Reply
Answers (
1
)
Angular Js Controller
How to do routing in angular js