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
aditya immadi
NA
215
24k
check user name with jquery not hitting method
Oct 27 2016 1:36 AM
hiall,
i wrote this for checking use name avialbiityy .the name with alert is pop up but the method in my controller not hitting any leads
function check() {
var Name = $("#checkid").val();
alert(Name);
$.ajax({
type: "POST",
url: "home/checkname/",
data: '{ UserName: Name }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(Name);
}
});
}
and in my controller
[AllowAnonymous]
public string checkname(string UserName)
{
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("select UserName From tbl_Login where UserName=@Name", con);
cmd.Parameters.AddWithValue("@Name", UserName);
con.Open();
SqlDataReader d = cmd.ExecuteReader();
if (d.HasRows)
{
return "fine";
}
else
{
return "****";
}
}
Thanks and Regard
Reply
Answers (
11
)
how to used sql server query in asp.net
asp.net mvc using entity frame work how can i prepare login