tags:

views:

27

answers:

1

This replaces the content in #message_here, each time. How do I get it to keep adding the content, by creating new divs for each message?

  var last_mess_id = 1;
  $('#load_mess').click(function(){      
      $('#messages_here').load('ajax/get_message.php?last_mess_id='+last_mess_id);
      last_mess_id++;
  })
+2  A: 

You can use a $.get() function instead, and during the callback function you specify function(data) { $('#messages_here').append(data); }

http://api.jquery.com/get/

.load() is meant to replace the content of the specified element, so avoid using that. http://api.jquery.com/load/

Robert
great thanks, works exactly
davivid