I’m using the $ajax interface, working from localhost.
First example works as expected, RequestUrl (seen e.g. in Chrome Developer tools network tab) is: /commentSubmitted
$.ajax({
type: "POST",
url: '/commentSubmitted',
data: "hi"});
This here doesn’t work as expected, it appends the current browser url (referrer) to it:
$.ajax({
type: "POST",
url: 'anyotherstring/commentSubmitted',
data: "hi"});
I would like to have the RequestUrl always be the exact string I specify. For some reason the RequestUrl looks like this: /nested/url/I/dont/care/about/anyotherstring/commentSubmitted
The second example, due to the nature of relative URLs, appends “anyotherstring/commentSubmitted” to wherever you are now. So if you’re at “/nested/url/I/dont/care/about/”, that’s where the POST request would go.
Instead, begin with a “/” to specify an absolute path.