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
John
NA
928
131.7k
How to call static web method using ajax
Jan 21 2017 4:56 AM
Getting alert as undefined in ajax
[WebMethod]
public List
getDHEW()
{
if (st == ConnectionState.Closed)
con.Open();
List
count = new List
();
cmd = new SqlCommand(quy1,con);
int dcnt = (Int32)cmd.ExecuteScalar();
count.Add(dcnt);
cmd = new SqlCommand(quy2,con);
int ecnt = (Int32)cmd.ExecuteScalar();
count.Add(ecnt);
//JavaScriptSerializer ser = new JavaScriptSerializer();
//return ser.Serialize(count);
return count;
}
Ajax call
$.ajax({
type: "POST",
url: "WebService.asmx/getDHEW",
contentType: "application/json; charset=utf-8",
data: {},
dataType: "json",
success: function (data) {
alert(data.d);
},
error: function (response) {
alert(response.d);
}
});
Reply
Answers (
3
)
Gridview Filter Functionality
Validation failed for one or more entities