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
Bobindra Kumar
1.4k
324
12.4k
Uncaught TypeError: setData.append is not a function
May 4 2018 3:38 AM
@model CrudPopupJquery.Models.EmployeeViewModel
@{
Layout = null;
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<div class="container" style="margin-top:3%">
<a href="#" class="btn btn-info" onclick="AddNewstudent(0)">Add New Employee</a><br/><br />
<table class="table table-striped" >
<thead>
<tr>
<th>EmpId</th>
<th>EmpName</th>
<th>EmailId</th>
<th>PhoneNo</th>
<th>Action(Edit)</th>
<th>Action(Delete)</th>
</tr>
</thead >
<tbody id="SetStudentList">
<tr id="LoadingStatus" style="color:red">
</tr>
</tbody>
</table>
</div>
<script>
$("#LoadingStatus").html("Loading...");
$.get("Home/GetStudentList", null, DataBind);
$.noConflict();
function DataBind(StudentList)
{
alert('hi');
var SetData = ("#SetStudentList");
for (var i = 0; i < StudentList.length; i++)
{
var Data = "<tr class='row_" + StudentList[i].EmpId + "'>"+
"<td>" + StudentList[i].EmpId + "<td>"+
"<td>" + StudentList[i].EmpName + "<td>"+
"<td>" + StudentList[i].EmailId + "<td>"+
"<td>" + StudentList[i].PhoneNo + "<td>"+
"<td>"+"<a href='#' class='btn btn-warning' onclick='Editstudent()'><span class='glyphicon glyphicon-edit'></span></a>"+"</td>"+
"<td>"+"<a href='#' class='btn btn-danger' onclick='Deletestudent()'><span class='glyphicon glyphicon-trash'></span></a>"+"</td>"+
"<tr>";
//setData.append(Data);
SetData.apeend(Data);
$("#LoadingStatus").html(" ");
}
}
</script>
Reply
Answers (
4
)
1
Manav Pandya
0
19.9k
2.3m
May 4 2018 6:07 AM
Hello
Observe my code what i have provided to you , do not judge by just watching content
Thanks
1
Bobindra Kumar
1.4k
324
12.4k
May 4 2018 6:03 AM
if i am taking var SetData = $("#SetStudentList"); then my function is not calling and whenever i am not taking $ before this when function is calling but getting this error
Uncaught TypeError: SetData.append is not a function
1
Bobindra Kumar
1.4k
324
12.4k
May 4 2018 5:24 AM
Sir All changes already corrected but i am still getting same error
1
Manav Pandya
0
19.9k
2.3m
May 4 2018 5:01 AM
Hello
From the first view , you have mistaken about spelling :
Written :
SetData.apeend(Data);
Should be :
SetData.append(Data);
Correct code
:
<!DOCTYPE html
>
<
html
>
<
head
>
<
script
src
=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
>
</
script
>
<
script
>
$(document).ready(function(){
alert('hi');
var
SetData
= $("#SetStudentList");
var
Data
=
"<tr class='row_"
+ 1 + "'
>
"+
"
<
td
>
1
</
td
>
"+
"
<
td
>
Manav
</
td
>
"+
"
<
td
>
a@b.com
</
td
>
"+
"
<
td
>
1234567891
</
td
>
"+
"
<
td
>
Edit
</
td
>
"+
"
<
td
>
Delete
</
td
>
"+
"
<
tr
>
";
//setData.append(Data);
SetData.append(Data);
});
</
script
>
</
head
>
<
body
>
<
table
border
=
"5"
class
=
"table table-striped"
>
<
thead
>
<
tr
>
<
th
>
EmpId
</
th
>
<
th
>
EmpName
</
th
>
<
th
>
EmailId
</
th
>
<
th
>
PhoneNo
</
th
>
<
th
>
Action(Edit)
</
th
>
<
th
>
Action(Delete)
</
th
>
</
tr
>
</
thead
>
<
tbody
id
=
"SetStudentList"
>
</
tr
>
</
tbody
>
</
table
>
</
body
>
</
html
>
EmpId
EmpName
EmailId
PhoneNo
Action(Edit)
Action(Delete)
1
Manav
a@b.com
1234567891
Edit
Delete
List of mistake
:
- you have not specified $ during gettingcontent of :
var SetData = ("#SetStudentList"); // add $ before
- unclosed tags
- You can put function outside document.ready and can call whenever you want
I think above solution will help you
Thanks
How to use window.location.href in component.ts
Want to display date in customized format