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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.