In example below i have 3 courses for employee michel
I have 3 courses per employee
c# removebutton
sql removebutton
java removebutton
i need to remove sql and java and store values in ids variable
i do it but when check variable ids it give me error
i check value of ids it give me error
local host 3642 says [object Object]
-
- "hidden" value="@ViewBag.hid" id="hid" />
- "submit" value="save" />
- "submit" value="getvalue" id="removeid" />
-
"tb">
- }

Midhun TpRank #388 · 6.5K reputationPosted Oct 2, 2016, 9:04 PM EDT
Delpin Susai RajRank #53 · 29.5K reputationPosted Oct 1, 2016, 9:50 PM EDT
Delpin Susai RajRank #53 · 29.5K reputationPosted Oct 1, 2016, 9:51 PM EDT
Midhun TpRank #388 · 6.5K reputationPosted Oct 1, 2016, 10:00 PM EDT
From your question, i think that you are not getting any errors. It is just the alert message coming. It comes like object, because you are putting an array inside alert. For your code to work you have do below things first-
Put below code,
var ids = {}; var i = 0; $(".remove").each(function () { ids[i] = $(this).val(); i++; });
inside below click function
$('#removeid').click(function () { //Here you put above script alert(ids); });
Now you get id's to remove in the ids array. You can loop through the array for getting id's
ahmed salahRank #2,612 · 534 reputationPosted Oct 2, 2016, 4:37 AM EDT
ahmed salahRank #2,612 · 534 reputationPosted Oct 2, 2016, 4:38 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Oct 2, 2016, 4:58 AM EDT
Why are you putting ids inside alert. You have to loop through the ids array as like below-
for(var k=0;k<ids.length;k++){
alert(ids[k]);
}
ahmed salahRank #2,612 · 534 reputationPosted Oct 2, 2016, 5:43 AM EDT
ahmed salahRank #2,612 · 534 reputationPosted Oct 2, 2016, 7:31 AM EDT
ahmed salahRank #2,612 · 534 reputationPosted Oct 7, 2016, 4:52 AM EDT