OK.
The advantage of using AJAX is to prevent having to reload the page each time the form is submitted, and
the advantage of using PHP is to insure that the submitted data is sanitized and validated.
Are implying with this that it is not possible to use Javascript for the purpose of sanitization and validation?
If I have understood correctly, AJAX serves only as an intermediary between the form page and the PHP page. In other words,
the PHP page should be written, as if the AJAX did not exist, and
the AJAX should always refer to the PHP page via the following piece of code
$.ajax({
url: 'ajax_comment.php',
What is more, the PHP code should only be included in the page, if the following condition is satisfied.
!isset( $_SERVER['HTTP_X_REQUESTED_WITH'] )
Thus, it was wrong for Loois to have included the following code at the bottom of his form page
include ("jquery.js");
Under the assumption that all of the above is correct, why is the following code not entered at the top of the form page?
include ("jquery.js");
My very best,
Roddy