mercredi 22 février 2017

Laravel vuejs: http post url not working when running from public folder

I've implemented a post ajax request using axios and vue library ,everything works fine when i am running in development mode (id localhost:8000).

But when i run from public folder(ie localhost/vutest/public) i my post url is not working as expected .

Here is the post route

Route::post('/test','HomeController@testPost');

JS

axios.post('/test',this.user)
                    .then(response => {
                      console.log(JSON.stringify(response.data));
                      this.error=response.data.errors;

                    })
                    .catch(function (error) {

                    });

This route (ie /test) works fine when i am running from localhost:8000

But running the app from localhost/vuetest/public ajax post url is not working.

When i check the developer console for the header information

Request URL:http://localhost/test
Request Method:POST
Status Code:301 Moved Permanently
Remote Address:127.0.0.1:80

Whats the issue?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lnNiNw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire