Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-07-2012, 02:20 PM   PM User | #1
ArnMan
New Coder

 
Join Date: Jun 2011
Posts: 18
Thanks: 7
Thanked 0 Times in 0 Posts
ArnMan is an unknown quantity at this point
Can I run a ajax inside of a ajax class?

I have a php page that contains info, and in the middle I have a 3 links going to another php page, which is then ajaxed underneath the 3 links. Too keep it simple im gonna leave out all the other nonnecessary php so as not to clutter the screen.

here is the main php file, just doing the basics
Code:
<?php
echo " some information here";
// several ifs and thens here
print "
	<table width='100%' border='1' cellpadding='5'>
  <tr>
    <td height='112'><table width='100%' border='1' cellpadding='5'>
  <tr>
    <td align='center'><a href='buy.php?step=1&npcid={$npc['npcid']}' class='ajaxtrigger'>
              Buy
            </a></td>";
			print"
    <td align='center'><a href='buy.php?step=2&npcid={$npc['npcid']}' class='ajaxtrigger'>Sell</a></td>";
	print '
    <td align="center"><a href="buy.php?step=3" class="ajaxtrigger">Quests</a></td>
  </tr>
</table>
&nbsp;
<table width="100%" border="1" cellpadding="5">
	';
	echo "
	<div id='buy'></div>
	";
echo "</table></table>
<script src='js/very-simple.js'></script>";


?>
contents of js file
Code:
$(document).ready(function(){
  $('.ajaxtrigger').click(function(){
    var url = $(this).attr('href');
    $('#buy').load(url);
    return false;
  });
});
Inside of the
Code:
<div id='buy'></div>
I have a while loop
inside of the loop I want to add a
Code:
<div id='qty'></div>
that reflects a change in the database when the person hits the sell submit button at the end of each while loop line.

Example lets say
Car Quantity sell price sell
mustang 5 500 (dropdown quantity select) sell submit button


lets say you select 2 and click sell, which goes to another page and updates the database to 3 and I want to use ajax the
Code:
<div id='qty'></div>
to reflect the new quantity, just in this line. I have tried to use it but all it does and remove the current Div ID which includes the while loop and puts, at the moment, just a echo'd statement, so I would know if it is working or not.

Is there a way for me to fix this?

Thank you in advance.
ArnMan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:11 PM.


Advertisement
Log in to turn off these ads.