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]
- <script>
- $(function () {
-
- var index = 0;
-
- $("#tb").on("click", ".r", function () {
-
- $(this).parent().parent().hide();
-
- $(this).parent().prev().prev().find("input").addClass("remove");
-
-
- });
- var ids = {};
- var i = 0;
- $(".remove").each(function () {
- ids[i] = $(this).val();
- i++;
- });
- $('#removeid').click(function () {
- alert(ids);
- });
-
- $.ajax({
- url: "/Employeedata/getcoursesbyempid",
- data:{x:$("#hid").val()},
- success: function (res) {
- $.each(res, function (i, e) {
-
-
-
- $("#tb").append("<tr><td><input type = 'hidden' name='empcourses[" + index + "].CourseId' value='" + e.Id + "'/></td><td>" + e.CourseName + "</td><td><input type='button' value='remove' class='r'</td></tr>")
-
-
-
- index++;
- });
- }
-
- })
- });
- </script>
- </head>
- <body>
- <div>
-
- <input type="hidden" value="@ViewBag.hid" id="hid" />
-
-
- <input type="submit" value="save" />
- <input type="submit" value="getvalue" id="removeid" />
-
- </div>
- <table id="tb">
-
- </table>
- }