Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

389
Visualizações
ajax POST, trying to add the directory link adds the path twice
            $.ajax({
                type: "POST",
                url: "/bbr-category-configuration",
                data: "category_data",
                dataType: "json",
                success: function (response){
                    console.log(response);
                }
            });

im testing out my ajax form in a console.log

1

it says 404 not found but I thought alright sure, I missed the full path so I added:

url: "clinical/bbr-category-configuration",

This time, the path goes through my clinical folder twice as seen in the next screenshot

2

How is this happening? (the directory getting added twice)

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

What you are defining are absolute and relative path of the url.

In JS or html file, if you redirect/request to any url with the /urlPath then your redirect/request will be from the base url(http://example.com/urlPath) onwards.

You can see this behaviour with simple anchor element. Just put these in the html file and you will see the result

<a href="clinical/bbr-category-configuration">Redirects from the current path</a>

<a href="/clinical/bbr-category-configuration">Redirects from the base url path</a>

The above clinical/bbr-category-configuration will redirect/request from your current url. if you are on https://example.com/url/url2 then you will go to https://example.com/url/clinical/bbr-category-configuration

So In your case you should use /clinical/bbr-category-configuration as mentioned by @Aless55

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda