138
rated 0 times
[
145]
[
7]
/ answers: 1 / hits: 6162
/ 4 Years ago, tue, february 25, 2020, 12:00:00
I need to view the ajax success message in my html table
my cshtml code is:
@*@{Customer.Models.Customers cust = ViewBag.Customers;
}*@
@{
}
<center><h1 style=color:red>User details</h1></center>
<div>
<table class=table>
<tr>
<td>ID</td>
<td>res.Id</td>
</tr>
<tr>
<td>FIRST NAME</td>
<td>res.Fname</td>
</tr>
<tr>
<td>LAST NAME</td>
<td>res.Lname</td>
</tr>
<tr>
<td>LOCATION</td>
<td>res.Location</td>
</tr>
<tr>
<td>Contact</td>
<td>res.Contact</td>
</tr>
<tr>
<td>Email</td>
<td>res.Email</td>
</tr>
<tr>
<td>Password</td>
<td>res.Password</td>
</tr>
<tr>
<td>Role</td>
<td>res.Category</td>
</tr>
<tr>
</table>
</div>
@section Scripts{
<script>
$.ajax({
contentType: application/json,
type: GET,
url: https://localhost:44397/api/Values/Details/ + id,
success: function (data) {
alert('Welcome!');
res = data;
// window.location.href = /Home/Details/ + data.id;
},
error: function (jqXHR, textStatus, errorThrown) {
$(#postResult).val(jqXHR.statusText);
}
});
</script>
}
Is there any way to use the success data to pass in the each table row?
That is I want the res to store the success data and then pass it to the table fields like res.Fname (eg) and it should display the data accordingly.
More From » html