Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7063155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:40:49+00:00 2026-05-28T04:40:49+00:00

My ajax call works only the first time. After that I get an Method

  • 0

My ajax call works only the first time. After that I get an Method not allowed exception.
Here is my java script code:

 $('.AppFormFormNewOT').submit(function () {

    var formID = $(this).attr('id');

    var appDate = $('#' + formID + ' .dateHiddenInput').val();
    var appMit = $('#' + formID + ' .mitHiddenInput').val();
    var am = $('#' + formID + ' .amCheckBox').attr('checked');
    var pm = $('#' + formID + ' .pmCheckBox').attr('checked');

    if (!am && !pm) {
        alert("Bitte geben Sie einen Halbtag an");
        return false;
    }
    var vorOrNach;
    if (am == 'true,false') {
        vorOrNach = 'FirstHalfDayHasAppointment';
    } else {
        vorOrNach = 'SecondHalfDayHasAppointment'
    }

    var url = 'Plan/' + vorOrNach + "/";
    var occupied = true;
    $.ajax({
        type: 'POST',
        url: url,
        datatype: 'text',
        async: false,
        data: {
            date: appDate,
            id_person: appMit
        },
        success: function (data) {
            occupied = data;
            if (occupied == "True") {
                alert("Hier ist bereits ein Termin");
                return false;
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert('Ajax error');
            alert(textStatus);
            alert(errorThrown);
            return false;
        }


    });
    if (occupied == "True" || occupied == true) {
        return false;
    } else {
        return true;
    }


});

The method it calls are simple:

[ScriptMethod][HttpPost]
    public string FirstHalfDayHasAppointment(DateTime date, int id_person)
    {
          bool hasApp = repo.dateWithPersonAlreadyHasApp(date, id_person, HalfDay.AM);
          return hasApp.ToString();


    }

    [ScriptMethod][HttpPost]
    public string SecondHalfDayHasAppointment(DateTime date, int id_person)
    {
        bool hasApp = repo.dateWithPersonAlreadyHasApp(date, id_person, HalfDay.PM);
        return hasApp.ToString();
    }

When I restart the application (not just reloading the page), again the first call works and any following calls fail again.

edit: When i just return true in the functions the ajax calls always succeed:

  [ScriptMethod][HttpPost]
    public string FirstHalfDayHasAppointment(DateTime appDate, int id_person)
    {
        return "True";



    }

    [ScriptMethod][HttpPost]
    public string SecondHalfDayHasAppointment(DateTime appDate, int id_person)
    {
        return "True";

    }

So the problem seems to be on the server side. But I don’t know what this has to do with ajax and why ajax returns a method not allowed exception. Hope this information is useful. Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:40:50+00:00Added an answer on May 28, 2026 at 4:40 am

    I changed the name of the variable ‘url’ to another name, for example ‘myurl’ and I worked. It seems the variable ‘url’ has some predefined value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing an AJAX call that returns some HTML and jQuery: <div id='selected'>Here
I call sortable.stop() to make an ajax call to store some data after drag
I have a jQuery AJAX call with type:'GET' like this: $.ajax({type:'GET',url:'/createUser',data:userId=12345&userName=test, success:function(data){ alert('successful'); }
I have an $.ajax call that includes both a success and error condition: $('input[name=StateName]').live('change',
I currently have a PrintingWebService that I call from an AJAX page with all
I have this code which works. $.ajax({ type: GET, url: includes/process.php, data: captcha= +
I am trying to pass 4 parms on an ajax call with jquery. Only
So here is my code: $(document).ready( function() { $('#form').bind('change', function(){ $.ajax({ type: 'get', url:
I've two php-scripts: the first makes ajax call to the second, which returns javascript
The first submit works as expected, but the next time it's fully posted back.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.