Znajdź zawartość
Wyświetlanie wyników dla tagów 'json' .
-
<html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="style.css" type="text/css"> <script src="jquery-3.2.1.min.js"></script> </head> <body> <div id="ramka"> <div id="centrum"> <div id="bardziej"> <img id='roll' src='img/roll.png'/><br/> <span></span> </div> </div> </div> </body> <script> $(function(){ setInterval(function(){ $.ajax({ url: 'fun/roll.php', type: 'POST', datatype: 'json', success: function(data){ var elo = JSON.parse(data); console.log(elo['quote']); }});},500);}) $("img").on("click", function(){ var los = Math.floor((Math.random() * 270) + 1); document.cookie = "roll=" + los; $.ajax({ url: 'fun/check.php', type: 'POST', data: {"check": "0"}})}) </script> </html> <?php $connection = mysql_connect("localhost", "root", ""); $roll = $_COOKIE["roll"]; if ($connection){ mysql_select_db("pgg"); mysql_query("set charset utf8"); $result['check'] = mysql_result(mysql_query("SELECT `check` FROM `com` WHERE `konkurs` = 1"),0); $result['quote'] = mysql_result(mysql_query("SELECT `str` FROM `quote` WHERE `id` = $roll"),0); mysql_query("UPDATE `com` SET `roll` = $roll WHERE `konkurs` = 1"); echo json_encode($result);} ?> powyzsze zwraca errory SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data[Learn More] syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Users\fortg\Downloads\s2g\server2go\htdocs\pgg\quote\fun\roll.php on line 10 (tj. ta z encodem) co sie dzieje?