I often see code where the ajax files being contacted (somefile.php
in the example below) are preceded with a /
Is this /
just to preserve the structure www.example.com/somefile.php
or is it for security reasons like escaping? If it's the latter, an explanation would also help..
$.post('/somefile.php', { id: id, val: val }, function(data) {
if (something) {
do something
} else {
do something else
}
});
Thanks.