daveVk

msg:4417784 | 7:04 am on Feb 15, 2012 (gmt 0) |
Assuming generated HTML has structure like <span onclick="getTeam(this,1234)"><span>Team 1</span><span class="reply"></span></span> function getTeam( spanEl, sqlId ) { spanEl.find('.reply').load( '/getteam.php?id=' + sqlId ); }
|
skoff

msg:4418044 | 1:16 pm on Feb 15, 2012 (gmt 0) |
thanks for the reply! but could you give me more information about the ajax code because im not really familiar with that. I dont really know the way on how to insert this in my code. Like i said, for the php/mysql thing i have no problem but for the ajax i dont know that much! Thanks again
|
daveVk

msg:4418192 | 10:54 pm on Feb 15, 2012 (gmt 0) |
spanEl.find('.reply').load( '/getteam.php?id=' + sqlId ) spanEl - is the span element clicked spanEl.find('.reply') - is the following span with class="reply" this we wish to update with php reply from server .load( '/getteam.php?id=' + sqlId ) - sends GET request to server in this case url is '/getteam.php?id=1234', change to whatever may be appropriate, returned html placed in element. see [api.jquery.com...] place javascript inside any existing javascript block, if none add to head section of html <SCRIPT type="text/javascript"> function getTeam( spanEl, sqlId ) { spanEl.find('.reply').load( '/getteam.php?id=' + sqlId ); } </SCRIPT> Note that .load() is GET request to server, if server update is involved .post() may be needed see [api.jquery.com...]
|
|