Hello i would require help with the given script AJAX $.ajax({ type: "post", url: "http://localhost/raffle.php", dataType: "json", data: { "postraffle": "true", "title": $("#rtitle").val(), "message": $("#mess").val(), "maxentry": $("#maxentry").val(), "duration": $("#durr").val(), "filter": $("#reffil").val(), "split": $("input[name=split]:checked").val(), "pub": $("input[name=rafflepub]:checked").val(), "stype": $("input[name=stype]:checked").val(), "invo": $("input[name=invo]:checked").val(), "items[]": itms, "games[]": gmes, }, success: function(data){ if(data.status == "fail") { alert(data.message); $("#rafBut").removeAttr("disabled"); $("#rafBut").attr("value", "Raffle it!"); } else if(data.status == "ok") { window.location.href = "http://localhost/raffle.php"; } } }); </script> Code (markup): And here is the php script <?php $data = array( 'status' => 'fail', 'message' => 'Failed to save data', ); echo json_encode($data); PHP: You can see the script live here admin.tftrg.com/Prototype/raffle.html I want all of the above data to transmit from HTML using ajax to php Well currently it shows an error FAILED TO TRANSMIT DATA Some help would be really appricated Thanks!
Uhm - of course it transmits "Failed to save data" - it's the only thing in the PHP-file. I'm confused as to what the problem is - it seems to be working just fine, from what you've posted here?
You could do it like this: <?php echo json_encode($_POST); ?> Code (markup): You should really check what's being posted and outputted. But that's up to you.