PDA

View Full Version : Dynamic Ajax Content



Joshh
03-05-2009, 03:05 PM
I'm using Dynamic Ajax Content off Dynamic Drive I have it all working fine, I'm more than capable of that. But say I wanted to add a throne generator to my site.. When they click "Generate" it takes you to the page the throne generator is on and doesn't load it into the actual content box, because to load it into the content box it needs an ajax link and with an <input type="submit"> button - you can't put links in can you? So is there a way of doing this?

Jake told me to ask Iszak but he isn't on MSN atm, anyone else know how I can do this? Thanks :P

eLv
03-05-2009, 03:11 PM
What I do is to put it in an iframe, and have it loaded into the divs.

Joshh
03-05-2009, 03:12 PM
Yeah I was gunna do that, but I wanted it all Ajax - Jake told me Iszak helped him do it once, so it is possible so does anyone know how? :)

DeejayMachoo$
03-05-2009, 04:12 PM
http://docs.jquery.com/Ajax/jQuery.post there u go :)

Joshh
03-05-2009, 06:24 PM
http://docs.jquery.com/Ajax/jQuery.post there u go :)

Thanks, but sorry to be a pain but I've looked through it and I'm not sure where I would add the codes say in the "Kissing Generator" script it says use a function like $.post but where abouts would I add it in a code like this?


<?php
if($_POST['submit'])
{
if($_POST['habbo1'] && $_POST['habbo2'])
{
echo "<img src=\"generate.php?habbo1=" . urlencode($_POST['habbo1']) . "&habbo2=" . urlencode($_POST['habbo2']) . "\" alt=\"Generated Image\" />";
echo "<br /><br />";
}
else
{
echo "<div style=\"background: #dd0000; color: #fff; margin: 5px; padding: 5px;\">All fields are required!</div>";
}
}
else { echo "<br />"; }
?>

<form action="" method="post">
Habbo One:<br /><input type="text" name="habbo1" maxlength="32" />
<br /><br />
Habbo Two:<br /><input type="text" name="habbo2" maxlength="32" />
<br /><br />
<input type="submit" name="submit" value="Generate" />
</form>

Sorry, I'm not very good with Ajax.

Blob
03-05-2009, 09:12 PM
Just have a blank div then update the div to contain the page throne.php?name=something or something like that (change your throne thing to GET and use onsubmit to do that using jquery)

Joshh
03-05-2009, 10:16 PM
Just have a blank div then update the div to contain the page throne.php?name=something or something like that (change your throne thing to GET and use onsubmit to do that using jquery)

I did GET and onclick="$.post("throne.php");"

but it didn't work, can you show me an example please xoxo

Mentor
05-05-2009, 08:21 AM
First off, Dynamic Drive is terrible, avoid anything thay make at any costs its bloat and more than that its bload that bearly works.
I posted a script that will do the ajax loading in the tutorials here a while back, its only a few lines but is much more robust and less error prone than the DD equivlent.

If doing the js all yourself desont have any real signifcance though DeejayMachoo has the right idea, JQuery is quick, easy and efficent, well worth the few minutes it takes to get your head round it :D

Mentor

Blob
05-05-2009, 05:47 PM
First off, Dynamic Drive is terrible, avoid anything thay make at any costs its bloat and more than that its bload that bearly works.
I posted a script that will do the ajax loading in the tutorials here a while back, its only a few lines but is much more robust and less error prone than the DD equivlent.

If doing the js all yourself desont have any real signifcance though DeejayMachoo has the right idea, JQuery is quick, easy and efficent, well worth the few minutes it takes to get your head round it :D

Mentor

OMG since when have you started posting again

Edited by Xarea (Forum Moderator): Please do not post off topic.

Want to hide these adverts? Register an account for free!