PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] Why are post requests not working and getting redirected?

 November 13, 2022     laravel, php, plesk, vue.js     No comments   

Issue

I am a beginner with laravel and vue and I have a problem with routes when I make post requests to the server it tells me that the request was redirected, and I don't know where the problem is since the get requests work normally, please help me

vue code

 await this.form.post('/api/add_tramite/').then(response=>{
                console.log(response.data);
                this.fecthtramitesper();
                this.close();
          })

my route in laravel

Route::post('add_tramite',[tramiteController::class,'agregar_tramite']);

Solution

You should remove the trailing / in your URI.

await this.form.post('/api/add_tramite').then(response=>{

many servers redirect any url with trailing slash to the version without the slash for different reasons, one of them being SEO.



Answered By - N69S
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing