Geriatrix
Executive Member
Noob fyi.
Ok so I've got a php page that writes out listings from a database into table format.
Lets say I've got 2 <td>'s per row. One is contains a usercode and one contains a name. I want each name to be clickable so that the <td> content changes to a textfield where you can change the name and onblur it updates the database with the new name. I got this working via JS and some ugly ass homebrew Ajax.
But now I'm learning jQuery because it seems it would be more efficient and useful for some of the other features on my site.
Now, I made the php script give each name <td> a class of 'username' and a unique id created with the related usercode read from the database, so that when I edit a name the corresponding usercode is passed to my database updating script.
jQuery and me aren't friends yet.
Which jQuery Ajax function should I use and how would I pass the related usercode from the previous <td> ?
I assumed I could $(".username").click(event) but how would I pass the related usercode with the new name?
Ok so I've got a php page that writes out listings from a database into table format.
Lets say I've got 2 <td>'s per row. One is contains a usercode and one contains a name. I want each name to be clickable so that the <td> content changes to a textfield where you can change the name and onblur it updates the database with the new name. I got this working via JS and some ugly ass homebrew Ajax.
But now I'm learning jQuery because it seems it would be more efficient and useful for some of the other features on my site.
Now, I made the php script give each name <td> a class of 'username' and a unique id created with the related usercode read from the database, so that when I edit a name the corresponding usercode is passed to my database updating script.
jQuery and me aren't friends yet.
Which jQuery Ajax function should I use and how would I pass the related usercode from the previous <td> ?
I assumed I could $(".username").click(event) but how would I pass the related usercode with the new name?