Your website address contains a leading slash in /Endereco/getEnderecos
, which can lead the browser to navigate to the root of the current host followed by the provided URL.
For instance, if you post to /somePage
from a page located at
www.mysite.com/folder/subfolder/page
, it will actually post to
www.mysite.com/somePage
.
To fix this issue, remove the slash before Endereco
, so your post
should be like this:
$.post('Endereco/getEnderecos', { CardCode: dado }, function (data) {
if (data) {
(...)
In response to your query, you could use the ..
notation to go up a folder:
$.post('../../Endereco/getEnderecos', { CardCode: dado }, function (data) {
if (data) {
(...)
If your original URL is
localhost/order/Endereco/getEnderecos
, after using two
..
components, the resulting URL would be
localhost/Endereco/getEnderecos
, as it went up two folders instead of one.
I came across a helpful tutorial on relative URLs that might give you more insight into HTTP URLs: . It could assist you in understanding HTTP URLs better =]