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
Santosh Sasupalli
NA
181
24.9k
wb api serviuces
Nov 14 2016 10:05 PM
this is my service
[HttpPost]
public AgentMasterEntity AgentLogin([FromBody]string username)
{
AgentMasterEntity Agent = new AgentMasterEntity();
Agent = am.AgentLogin(username[0].ToString(),username[1].ToString());
return Agent;
}
this my jquery to call that sevice:
function testapi()
{
alert("enter");
var username = "santu";
var password = "hgf";
$.ajax({
type: "POST",
url:"http://localhost:1427/api/Agent/AgentLogin",
data:JSON.stringify([username,password]),
contentType: "application/json; charset=utf-8",
dataType: "text json",
success: function (resp) {
alert("ahi");
},
error: function (jqXHR, exception) {
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
}
});
}
out5 put shows Internal Server error:
please help me im new to web api...
is my code wrong and how can i pass values frombody values
Reply
Answers (
2
)
Services to Android Or ios developer
question about web.config wcfConnectionService