I have some dialog window with buttons, on the submit button I call this:
$("#delDiv").load("./protected/deleteUser.php?id="+id, function(data){
alert(data);
});
Problem is, that my /protected directory is protected with .htaccess file, where I had simply set
deny from all
so the .load() command doesn´t have access to that file. Is there any way to access that folder of file for this function?
The solution really depends on framework/application structure. In general I'd suggest to place
deleteUser.php
in publicly available directory, because everything you can call using AJAX will be available to opening directly in browser. In fact, you can check some headers in order to know if request is performed using AJAX or not, but they are very easy to fake.Also, if you are using any framework, it is better to use its controller+action system, not just a standalone script.