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

263
Visualizações
Ajax Call return error like "The POST method is not supported for this route. Supported methods: OPTIONS " in Laravel

I am fetching some data from server using ajax on page loading. But these calls always returns error as The POST method is not supported for this route. Supported methods: OPTIONS. I have tried all the options I can but no use. Here is my code.

        var today = new Date();
        var monthYear = moment(today).format('MMM/YYYY');
        $.ajax({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            url: baseUrl + 'statisticalboxes',
            method: 'POST',
            data: {
                'project-month': monthYear
            },
            success: function(data) { 
                console.log(data);
            },
            error:function(e) {
                console.log(e);
            }
        });

web.php

Route::post('statisticalboxes', ['as' => 'statisticalboxes','uses' => 'DashboardController@getStasticalBoxData']);

I have changed method into all other options, but no use. When I look into the network tab, the requested url look like Request URL: http://127.0.0.1:8000/nullstatisticalboxes, but the actual one is Request URL: http://127.0.0.1:8000/statisticalboxes

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

0

Your baseUrl variable return null value.

Where you define baseUrl?

Define baseUrl variable.

--- OR ---

Use url like this.

url: '/statisticalboxes',
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