how to get base url in jquery with index.php code example Example: js get base url var url = window.location.origin;