Here is my code
$('#right').load('textes.html #nicolas');
$('#right').load('textes.html #antoine');
the problem is that the content of the div antoine overwrite in the right div the content load by the div nicolas
div #right : load div nicolas from file textes.html = ok div #right : load div antoine from file textes.html = overwrite content = No!
I like to append antoine to nicolas I like to add nicolas then add antone so the #right will be nicolas + antoine
I have try to get the content into a var... nope
any idea ?
on top of that... i will like to add a rule <hr>
BETWEEN each load
Maybe something like that can be done... it don't work !
$('#right').load('textes.shtml #nicolas').append('<hr>').load('textes.shtml #antoine'); return false;
See the appendTo function.
Maybe I'm missing something but it seems like you all have been missing the fact that this is an ajax call and you are calling functions procedurally and not as a callback function based on a successful ajax response.
Besides, if you are doing anything more complex than loading some (X)HTML into an element, you should probably use one of the more powerful jQuery ajax methods (i.e., get() or post() or ajax()).
Assuming you'll get (X)HTML in the response:
It's really as simple as that.
WHy not load them both in one call:
EDIT
Inspired by Justice way I thought of the follwoing:
This will make only one (or two, depending on what firefox feels like) calls to the server. Thus saving bandwidth. But it also gives you more freedom in how to insert the elements and in which order.
Or, Pim Jager's way.
Here's the full source code for a solution.
I've hosted a working sample on JSBin.com: http://jsbin.com/ulodu (Editable via http://jsbin.com/ulodu/edit)
I got it working with the REALLY SIMPLE answer of KyleFarris
I even simplified it a little more, and it work fine
Thnaks everyone, here is the final code :