Pro_Lamer4e
Registered
като изтегла касмет отново ми презарежда страницата , а мен това не ме устроива
PHP:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
// Attach a submit handler to the form
$( "#kasmeti" ).submit(function( event ) {
// Stop form from submitting normally
event.preventDefault();
// Get some values from elements on the page:
var $form = $( this ),
term = $form.find( "input[name='s']" ).val(),
url = $form.attr( "action" );
// Send the data using post
var posting = $.post( url, { s: term } );
// Put the results in a div
posting.done(function( data ) {
var content = $( data ).find( "#content" );
$( "#result" ).empty().append( content );
});
});
</script>
<?php
if(isset($_POST[iztegli]))
{
$kasmeti = mysql_fetch_array(mysql_query("select * from kasmeti where acepted = '1' order by rand() DESC limit 1"));
?>
<div id="result"><?php echo "Изтеглихте : $kasmeti[kasmet]<br><br>Добавил : <B>$kasmeti[author]</b><Br><Br>"; ?> </div>
<?php
}
?>
<form method="post" action="" id="kasmeti">
<input type='submit' class='gbutton' value = 'Изтеглете късметче' name = 'iztegli'>
</form>