Relative path problem jQuery


I have a relative path issue when using jQuery in that I am using the same ajax function sitewide and I don’t know how I can send a request to a PHP file without needing to provide the full absolute path.

For example, the below code works at top level, but will not work if called from inside a sub folder.

$.get("./ajax/locations.php", { input: $(this).val(), standardajax: '2' },function(data)
// code here

You can make it relative from the root directory instead. “/ajax/locations.php”