Monday, July 27, 2009

[jQuery] after together with load

Hi,

I am trying to dynamically load html into a table, i.e add new rows in
the table if a user clicks on an element in the table.

Calling code :

<TD><a href="#" onClick="javascript:AddElement('someVal',
'someOtherval');return false;">Click ME</a></TD>

No problems there, I have a function :

function AddElement(someval, i) {

$('.mytable').load("http://www.someURL.com/?page=moretabletest");

}

I have tried using the .after method (I am not sure if that is the
right terminology).

$('.mytableRow').after('<tr><td></td></tr>); // Works !

This works fine , however I cannot figure out how to use .load()
and .after together. I.e instead of hard coded HTML to add , I want to
add HTML into my table from a GET to the server.

Any ideas ?

No comments: