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 TpPosted Oct 3, 2016, 1:04 AM
ahmed salahPosted Oct 7, 2016, 8:52 AM
ahmed salahPosted Oct 2, 2016, 11:31 AM
ahmed salahPosted Oct 2, 2016, 9:43 AM
Midhun TpPosted Oct 2, 2016, 8:58 AM
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 salahPosted Oct 2, 2016, 8:38 AM
ahmed salahPosted Oct 2, 2016, 8:37 AM
Midhun TpPosted Oct 2, 2016, 2:00 AM
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
Delpin Susai RajPosted Oct 2, 2016, 1:51 AM
Delpin Susai RajPosted Oct 2, 2016, 1:50 AM