How to map index using jquery to repair indexes when remove

Problem
when remove any course from table list html his position in center or first it make problem

in index in database

Details

IF I have list of courses as following :

Delphi

Flash

Photoshop

IF I remove flash by JQUERY remove button then click save button

it delete flash and Photoshop

because there are wrong in delete courses by using remove function in jquery

if i remove php it is working without any problem because it is last item

suggestion

using map function when remove but how to do that

if there are any solution for that without using map no problem

I post fiddle here
i post the fiddle here

to see image what i need below

see image below to understand what i need

It’s the index value that you’re putting in the empcourses[] array that’s messing you up.
Remove that index value and the server-side can then access them.

can you show me how i remove

Sure, there are two places in the code where you append html content with rhe index. Just remove the index part of that code.

i modify my code as you tell me in the following lines

   $("#tb").append("<tr><td><input type = 'hidden' name='empcourses.CourseId' value='" + e.Id + "'/></td><td>" + e.CourseName + "</td><td><input type='button' value='remove' class='r'</td></tr>")

are that what you mean

are this value above is true
how to manage index

Don,t remove the square brackets from the end of the name attribute, for that allows PHP to receive the information as an array.

OK but how server side know that item hide
to know what i mean see link below

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.