I need help, I hope someone can help me =) What I want to do, of course, can be done, but I'm doing something wrong: I want to create an XML file when I use the Ajax call. I got the following code (synthesized). Note that this example does not work, it just illustrates:
HTML
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script> </head> <body> <p>Create XML on server!</p> <form id="prog" method="POST"> <input type="text" id="test" /> <button id="submit" type="submit"> Create now! </button> </form> <script> jQuery.noConflict(); jQuery(document).ready(function($){ var test = $('#test').val(); </script> </body> </html>
PHP on the server
<?php echo "HI! Ajax arrived here and this code it being executed!";
In this example, the PHP code works as it is, and the other does not. But in the whole context of my code, the Ajax call works, I have no doubt, because it does the rest that it only needs to create the XML code, no. Having the exact same PHP code as here, if I make an Ajax call to a file that he did not create ... If in the console I do
php createXML.php
The XML file that he created successfully. So this is not PHP code and at the same time it is not an error in my Ajax call, because it does everything that is needed. What can happen??? Of course, I missed something, THANKS !!!! =)
EDIT: In my real code in the PHP file on the server, I do this:
$test = (isset($_GET['test'])) ? $_GET['test'] : null; //If something fails, I add the error to an errors array: $errors = array(); isset($errors); if (!$test) $errors[count($errors)] = 'Something failed with the test!'; //If there are any errors if (!$errors) { createXML (); }
This createXML () function contains my previous code.