azpilot2211 Posted October 17, 2009 Share Posted October 17, 2009 I have tweeked this script to almost do what i am wanting. Problem is, i would like to be able to click the link to add the value to the div, and click another link to add another value to that same div. Each click now replaces any value that is currently in the div. Help is appreciated. my code: <script type="text/javascript"> /* ajax.Request */ function ajaxRequest(url,data) { var aj = new Ajax.Request( url, { method:'get', parameters: data, onComplete: getResponse } ); } /* ajax.Response */ function getResponse(oReq) { $('result').innerHTML = oReq.responseText; } </script> <? include "db.php"; $sql="SELECT * FROM inventory"; $result=mysql_query($sql); while($rowx=mysql_fetch_array($result)){ $status = $rowx['status']; $id = $rowx['id']; $part = $rowx['part']; ?> <tr> <td> <a id="myval" href="#" onClick="ajaxRequest('parse.php', 'val='+'<? echo $part; ?>')"><? echo $rowx['id']; ?></a> </td> </tr> <br /> <? } ?> <div id="result"></div> and parse.php is simply: <? if(isset($_GET['val'])) { $id=$_GET['val']; echo $id; } ?> I hope i made sense. Thanks for pointing me in the right direction. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.