Aktualisieren Sie den Code wie folgt und versuchen Sie Folgendes:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" name="paypalform" id="paypalform">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXX">
<button type="submit" class="radius paypal-button prevented" name="submit" id="paypalsubmit" alt="PayPal - The safer, easier way to pay online!">Buy Now!
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Und das Skript geht wie folgt:
<script>
$(document).ready(function(){
$('#paypalsubmit').click(function(e) {
if($(this).hasClass('prevented')){
e.preventDefault();
$(this).removeClass('prevented');
$.post( "ajax.create_sponsorship.php",{ data: 'XXXXXX'}, function( result ) {
if(result){
$('#paypalsubmit').click();
return true;
}
});
}else{
$('#paypalform').submit();
$(this).addClass('prevented');
}
});
})
</script>
Hoffe das hilft.