jquery and php ajax
Hi
I have a Front.php page which loads an external php page using:
<script type="text/javascript">
$(document).ready(function() {
//burnbackend is echoed to div commentfeed.
$("#commentfeed").load("burnbackend.php");
$("#shuffle").submit(function(){
var voteone= $("#voteone").val();
$.get("burnbackend.php", { voteone : voteone}, function(data) {
$("#commentfeed").html(data);
});
});
</script>
//inside body
<div id="commentfeed"></div>
burnbackend.php is a page that echos a form the problem is that using jquery ajax I would like to submit the echoed form
to burnbackend.php and load a different result.
burnbackend.php
<?Php
if($_GET['voteone'])
{
//Here the submit of the vote is done and some database stuff.
echo "vote done";
echo'
<form name="shuffle" id="shuffle" action="" method="get">
<input type="hidden" id="voteone" value="VOTE HERE"/><br/>
<input type="submit" id="submit" value="SHUFFLE BUTTON"/><br/>
</form>';
}
else
{
echo'
<form name="shuffle" id="shuffle" action="" method="get">
<input type="hidden" id="voteone" value="VOTE HERE"/><br/>
<input type="submit" id="submit" value="SHUFFLE BUTTON"/><br/>
</form>';
}
?>
The problem in a way goes like this: How do I submit an echoed form from a loaded external page using j query from the
page that loads the external page.
Thanks.
Please ask more questions if the problem is un understandable.
