homepage Welcome to WebmasterWorld Guest from 174.129.103.100
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
AJAX Delete multiple records with checkboxes?
alphacooler




msg:3084861
 9:00 pm on Sep 15, 2006 (gmt 0)

I'm a bit stumped as to how to approach this problem. I have a mail interface that shows message titles with a check box next to them which allows multiple messages to be deleted at once(very standard). But how can I do this AJAX style without a page refresh? Currently I just use a foreach $_POST['checkbox'] and loop through delete queries with PHP alone.

But I would like to use JS to grab all of the recordID's that need to be deleted and then somehow get them over to a php script.

Any guidance would be greatly appreciated.

 

Chico_Loco




msg:3085774
 8:03 pm on Sep 16, 2006 (gmt 0)

How about using a table row for each message, assigning it an "id" of {message no}. So <td id=""4> for example, with the checkbox of the same name.

Then for each click of a checkbox: add message no. to some array.

When submitted: send array as query string (delimited by whatever). Delete each message, then, when you get a successful server response, loop through array again and do id.innterHTML=""

Table rows may not be the best because they may leave an space when empty (depending on your table style). Perhaps <div>'s with <span>'s would be a better option, with the id on the div.

Any use?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved