I am doing a CRUD with vue.js and php. I installed the axios and I believe it is working. I just don't know how to call the php file that connects to the database and creates, read ...
The folder structure:
An excerpt from my script:
<script>
import axios from 'axios';
export default {
name: "HelloWorld",
data() {
return{
showAddModal: false,
showEditModal: false,
showDeleteModal: false,
errorMsg: "",
successMsg: "",
projects: [],
newProject: {
title: "",
},
currentProject: {},
}
},
created: function () {
this.getAllProjects();
},
methods: {
getAllProjects: function () {
axios
.get("../php/action.php?action=read")
.then(function (response) {
if (response.data.error) {
this.errorMsg = response.data.message;
} else {
this.projects = response.data.projects;
}
});
},
