Despite the long hours of googling, Ajax does not connect to any. I simplified the code to the maximum.
This is the main index.php
file. Jquery, as you can see, connected:
<!DOCTYPE html> <html> <head> ... <!--js--> <script src="js/jquery-3.0.0.min.js"></script> <script src="js/CreateLayout.js" type="text/javascript"></script> </head> <body> <?php echo 'TestResult '. $_POST['testData']; ?> </body>
The Ajax request itself is in an external file ( js/
directory):
$.ajax({ type: 'POST', url: 'index.php', data: 'testData=test' });
I use NetBeans in conjunction with OpenServer, landing page address; displayed in the browser - http://testproject/index.php
. I admit that it may be wrong to write the address in the request; I tried both http://testproject/index.php
, and testproject/index.php
, but nothing changes.
What else is worth trying?