Below are the relevant lines of code:
update.js
$('#tablePlaceholder').load('updateTable.php');
updateTable.php
$path = $_SERVER['REQUEST_URI'];
Normally $_SERVER['REQUEST_URI']
returns the URL, however in this case, the URI at the moment of the request is technically the PHP file, so what is returned is updateTable.php
instead of the actual URL. Is there an alternate command I can use to get the URL instead of URI? I have resorted to storing the URL in a session/global variable to retain access to the actual URL in the PHP file, but it seems there must be a better way, though I have not found it. Any tips would be most welcome!
I was looking at the documentation for the jQuery load()
command:
http://api.jquery.com/load/
It looks like I might be able to pass the URL as a string via the data argument?