I am trying to make a highscore list. i have been seaching everywhere for an answer to this. but I can't seem to find an answer that works. yesterday I made it work yesterday. not sure which code i used think it was something like
window.location = "hihgscore_code.php=" + score
but this make it go to a new web page. i would like it to stay on my web page. then i know i have to use ajax. so i have tried post. and ajax function with the jquery but now where i want the score to stand it only becomes blank. I see no point adding my code here since it has becomed a mess after all my atempts and i am not sure what it says anymore :S
My goal is to send the score from my game made with javascript to php so that it gets the highscore list from the database and then check if the score is high enough to get on the list. then I will use <form>
and <input>
s to add name to the list. but for that to happen i need to get my javascript variable score into php variable :S
I hope you understand what i am trying to do if not ask. and I will try explaining it better!
i have tried window.location = "hihgscore_code.php=" + score it works but i get rerouted to http://mcclane654-productions.co.nf/game/highscore_code.php?score=7. i also most recently tried
$.ajax({
type: "POST",
url: 'highscore_code.php',
data: "score=" + killed})
and then used
$score = $_POST['score'];
in php to get it.
i did try a version of post yesterday in my javascript and same code in php. also tried with _GET in my php code -.-