Jump to content

getResponse show in div More than one response?


azpilot2211

Recommended Posts

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.