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
Dima Alek
NA
43
2k
How can I use autocomplete textbox in "each" loop in table
May 19 2020 2:04 AM
$.ajax({
type:
"GET"
,
url:
"/Home/JsonWeekEvents"
,
dataType:
"JSON"
,
success:
function
(result) {
$.each(result,
function
(i, val) {
var
trow = $(
'<tr/>'
).data(
"id"
, val.Id);
//trow.append('<td>' + val.Id + " " + '</td>');
trow.append(
'<td style="padding:5px; width:100px; height:70px"></td>'
);
trow.append('<td valign=
"top"
style="padding:2px; width:150px;
height:100px">' +
'<div class="ui-widget">'
+
'<input size="10" maxlength="10" id="tagsM" />'
+
'<input type="button" id="addBtn" onclick="addEvent();" size="5" value="+" /><br/>'
+
'<div style="text-align:center" id="desc_Num">'
+ val.Monday +
'</div >'
+
'</div >'
+
'</td>'
);
tab.append(trow);
});
$(
"tr:odd"
, tab).css(
'background-color'
,
'#C4C4C4'
);
$(
"#weekEvents"
).html(tab);
},
error:
function
() {
alert(
"Failed! Please try again."
);
} });
var
tab = $(
'<table class=MyTable border=1 ></table>'
);
var
thead = $(
'<thead></thead>'
);
thead.append(
'<th style="padding:5px">FSE'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Monday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Tuesday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Wednesday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Thursday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Friday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Saturday'
+
" "
+
'</th>'
);
thead.append(
'<th style="padding:5px">Sunday'
+
" "
+
'</th>'
);
tab.append(thead); tab.on(
"focus"
,
"input[id='tagsM']"
,
function
(e)
{ $(
"#tagsM"
).autocomplete({
source:
function
(request, response) {
$.ajax({
url:
"/Home/GetSearchValue"
,
dataType:
"json"
,
data: { search: $(
"#tagsM"
).val() },
success:
function
(data) {
response($.map(data,
function
(item) {
return
{
label: item.Title +
', '
+ item.Description, value:
item.Title,
Id: item.Id,
Title: item.Title,
Description: item.Description,
Location: item.Location
}
}));
},
error:
function
(xhr, status, error) {
alert(
"Error!"
+ xhr);
},
});
}
});
Reply
Answers (
1
)
Ajax Problem With Downloading File
Vertical scroll bar (Header Alignment)