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
ahmed salah
NA
530
149.7k
json data not show in table when click button jquery
Jul 23 2016 11:37 PM
I have url www.DevuEgypt.com/api/employees i need to display FirstName,Id,Salary in table by click button using jquery
when click button not give me any result and give me two message
I try more time but it give me error
submit handler has fired this is normal to check
error error not found this message show to me
my code as below
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name=
"viewport"
content=
"width=device-width"
/>
<title>Index</title>
<script src=
"~/Scripts/jquery-1.10.2.js"
></script>
<script>
$(function () {
$(
'#btn'
).click(function () {
alert(
"submit handler has fired"
);
$.ajax({
// type: 'POST',
url:
'www.DevuEgypt.com/api/employees'
,
data:{},
dataType:
'json'
,
success: function (data) {
$.each(data, function (index, value) {
var row = $(
"<tr><td>"
+ value.FirstName +
"</td><td>"
+ value.Id +
"</td><td>"
+ value.Salary +
"</td></tr>"
);
$(
"#myData"
).append(row);
});
},
error: function (jqXHR, textStatus, errorThrown) {
alert(
'error: '
+ textStatus +
': '
+ errorThrown);
}
});
//return false;//suppress natural form submission
});
});
</script>
</head>
<body>
<div>
<input type=
"button"
value=
"GetData"
id=
"btn"
/>
<table id=
"myData"
></table>
</div>
</body>
</html>
Reply
Answers (
1
)
get the value of row before changing in table if cancel clic
How to hide all div's with same class name in a page?