Vue.js GET ajax request Fetch Data using PHP

Vue.js GET ajax request Fetch Data using PHP

In this Post We Will Explain About is Vue.js GET ajax request Fetch Data using PHP With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vue.js GET ajax request with PHP (Fetching data) Example

In this post we will show you Best way to implement Vue.js Get JSON Data From MYSQL Database Using PHP, hear for how to retrieve data from mysql database in Vue.js with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  Vue js Axios HTTP Post Method Example Tutorial From Scratch

Creating our Database

CREATE TABLE `students` (
  `studentfname` VARCHAR(30) NOT NULL,
  `studentlname` VARCHAR(30) NOT NULL,
PRIMARY KEY(`studid`)

Inserting student Data into our Database

INSERT INTO `students` (`studid`, `studentfname`, `studentlname`) VALUES
(1, 'jaydeep', 'Gondaliya'),
(2, 'krunal', 'sisodiya');

Include External Libs


<!DOCTYPE html>
<div class="container">
	<h1 class="page-header text-center">Example of the Vue.js CRUD OPERATION with PHP and MySQLi</h1>
	<div id="students">
		<div class="col-xl-8 col-xl-offset-2">
			<div class="row">
				<div class="col-xl-12">
					<h2>Student List
					<button class="btn btn-success pull-right"><span class="live glyphicon glyphicon-plus"></span> Student</button>
			<table class="table table-bordered table-striped">
					<th>Student Firstname</th>
					<th>Student Lastname</th>
					<tr v-for="stud in students">
						<td>{{ stud.studentfname }}</td>
						<td>{{ stud.studentlname }}</td>
							<button class="live btn btn-success"><span class="live glyphicon glyphicon-edit"></span> student Edit</button> <button class="live btn btn-danger"><span class="live glyphicon glyphicon-trash"></span> Remove</button>
<script src="vue.js"></script>
<script src="axios.js"></script>
<script src="main.js"></script>


$conn = new mysqli("localhost", "username", "password", "databasename");
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
$out = array('error' => false);
$crud = 'read';
	$crud = $_GET['crud'];
if($crud = 'read'){
	$sql = "select * from students";
	$query = $conn->query($sql);
	$students = array();
	while($row = $query->fetch_array()){
		array_push($students, $row);
	$out['students'] = $students;
header("Content-type: application/json");
echo json_encode($out);


var main = new Vue({
	el: '#students',
		students: []
	mounted: function(){
		getAllStudents: function(){
					main.students =;

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Read Also:  Concatenation string and Class in VueJS


I hope you have Got What is How to get data from MySQL with Vue.js – PHP And how it works.I would Like to have FeedBack From My Blog( readers.Your Valuable FeedBack,Any Question,or any Comments about This Article( Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Axios Post Request in vue.js
  2. Read Also:  Difference Between Managed and Unmanaged Code in C#.NET
  3. Read Also:  Vue js Axios HTTP Get Method Example Tutorial From Scratch
  4. Read Also:  Get Current User ID from Mysql in Laravel
  5. Read Also:  Get multiple checkbox value using jquery PHP
  6. Read Also:  Laravel 6 get last Insert id from query builder
  7. Read Also:  Vue JS Axios Post Request using Laravel Example
  8. Read Also:  Vuejs Restful Http Post and Get Web Api Calls
  9. Read Also:  Fixed Position Elements in CSS Examples
  10. Read Also:  Simple JQuery Ajax Request Example with Laravel 6