views:

22

answers:

1

My Question is suppose I have a form which needs validation through AJAX. The AJAX is sending data to to a file called do_ajax_validation.php. Now should I put this file in 'include' folder and name it do_ajax_validation.inc.php and bar it from direct access of the user or should I put it in the directory in which the original form resides?

Edit: And the same question is for the files which do processing of data of forms (or the files which are defined in the action property of the form tag)

+1  A: 

You can't prevent the user from directly accessing the file. If you do, you prevent the XMLHttpRequest object from accessing it too!

You should have a reasonable URI for the XHR to access. Beyond that, structure your files in whatever fashion makes the site easiest to maintain.

David Dorward
Thanks David... u cleared my doubt
Arup