Hello, you need to transfer json string from one php file to another. In the first file I wrote the following code:
$json = array("item" => "dress", "id" => "353" ); echo json_encode($json); In the second file I try to catch the string through JS and display it in the browser when I click on the button:
<button id="showTableBtn">SHOW TABLE</button> <div id="table"></div> <script> $('#showTableBtn').click(function() { $.getJSON("file1.php", function(data){ $("#table").html(data.item); }); }); </script> But when you click on the button does not display anything. Tell me, please, what am I doing wrong?
<?phpat the beginning of the file?) - Alexey Shimansky