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

265
Views
Error de devolución de llamada Ajax como "El método POST no es compatible con esta ruta. Métodos compatibles: OPCIONES" en Laravel

Estoy obteniendo algunos datos del servidor usando ajax en la carga de la página. Pero estas llamadas siempre devuelven un error ya que The POST method is not supported for this route. Supported methods: OPTIONS . He probado todas las opciones que puedo pero no sirve. Aquí está mi código.

 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']);

He cambiado el método a todas las demás opciones, pero no sirve. Cuando miro en la pestaña de red, la URL solicitada se parece a Request URL: http://127.0.0.1:8000/nullstatisticalboxes , pero la URL real es Request URL: http://127.0.0.1:8000/statisticalboxes

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Su variable baseUrl devuelve un valor null .

¿Dónde defines baseUrl ?

Defina la variable baseUrl .

--- O ---

Use una url como esta.

 url: '/statisticalboxes',
over 4 years ago · Santiago Trujillo Report
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!