Prompt a simple working example of communication of these entities (json (file) ajax php).
<html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs jquery/1.4.3/jquery.min.js"></script> </head> <body> <script type="text/javascript"> $(document).keyup(function(){ $.ajax({ url:'json.php', type:'POST', data:{'data':JSON.stringify(["Яблоко", "Апельсин", "Слива"])} }); </script> <form action=""><input type="search" id="search-text"> <input type="submit"></form> </body> </html>
php
var_dump(json_decode($_POST['data']));
Where is the mistake? How to add a file here?