Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!