[Vuejs]-Post form data to php script using axios

0👍

Your php only acts when it’s a GET Call, limonade’s dispatch() is for GET only.

In your php you are creating a GET endpoint on the /api/ url that will execute the test1 function. Meaning when you call /api via get, you will get Hello as answer.

if you want that to be POST (without touching your javascript) the php should be something like:

 # '/' because you are calling to http://localhost/index.php/ it could be '/whatever' if you call http://localhost/whatever (assuming you have configured everythign as limonade recomends)
function test2()
dispatch_post('/', 'test2'); 
{
    return 'Hello via post';
}

Leave a comment