I have url 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
[/code]
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
Code:
[code]
@{
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: '[URL unfurl="true"]www.DevuEgypt.com/api/employees',[/URL]
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>