On Nov 30, 11:00 am, Jerry Johnson <jerryhost....@gmail.com> wrote:
> Ya, here is my problem. I know how to make the ajax call, and it all works,
> but, I need to somehow connect the msg id from the mysql database to the
> ajax call, so I need another div, that has the id.

There are many ways to do this.  One simple one is to use an id, or
part of one, now that you know not to repeat the ids or use completely
numeric ones.  Something like this:

  <div class="message" id="msg-1">Message 1 here. (<a href="deleteMsg/
1">delete</a>)</div>
  <div class="message" id="msg-2">Message 2 here. (<a href="deleteMsg/
2">delete</a>)</div>
  <div class="message" id="msg-3">Message 3 here. (<a href="deleteMsg/
3">delete</a>)</div>

    $("div.message a").click(function() {
        var $msgDiv = $(this).parents("div:first");
        var id = $msgDiv[0].id.substring(4);
        alert("Pretending to do ajax call involving message " + id);
        $msgDiv.fadeOut();
        return false;
    });

See http://jsbin.com/ebapo (code http://jsbin.com/ebapo/edit)

Good luck,

  -- Scott

Reply via email to