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

114
Visualizações
Weird issue Ajax calls wrong aspx.cs file

I have a weird issue.

When I use Ajax to call a function in an aspx.cs file, the Ajax sends the request in the wrong aspx file even if I ask another file. In fact, every time I try it call the aspx.cs file of the first page.

this is my ajax :

    $.ajax({
        type: "POST",
        url: "NewLayerPage.aspx/getData2",
        data: dataToSend,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            console.log(dataToSend);
            console.log("data sended");
        },
        failure: function (response) {
            alert(response.d);
        }
    });

When I use that code in a function, it is looking for "getData2" in "FirstPage.aspx.cs" instead of "NewLayerPage.aspx.cs". I'm sure my function in NewLayer work because when I copy/paste it in FirstPage I have no issue. This is my error :

Any ideas ? Thanks for all !

EDIT : So when I comment the function in "firstPage" I got an error as you can see here :

But if I do not comment the function I do not have an error:

about 4 years ago · Juan Pablo Isaza
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