erased the ajax test
This commit is contained in:
parent
b52de633b0
commit
4d9f3d8648
@ -79,28 +79,6 @@
|
||||
<router-link to="/bookmark" class="nav-item nav-link"><i class="material-icons">bookmark</i></router-link>
|
||||
<router-link to="/profil" class="nav-item nav-link"><i class="material-icons">person</i></router-link>
|
||||
</nav>
|
||||
|
||||
<!--test to put information into db by ajax-->
|
||||
<div class="container">
|
||||
<div class="col-sm-4">
|
||||
<h3>Ajax Test</h3>
|
||||
<div>
|
||||
<form id="messageForm">
|
||||
<div class="form-group">
|
||||
<label for="id">Id:</label>
|
||||
<input type="text" class="form-control" id="id" placeholder="Enter Id"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message">Message:</label>
|
||||
<input type="text" class="form-control" id="message" placeholder="Enter Message"/>
|
||||
</div>
|
||||
<div id="res">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default" @click.prevent=testform>Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -116,27 +94,6 @@
|
||||
const router = new VueRouter({
|
||||
routes
|
||||
});
|
||||
var app = new Vue({
|
||||
router,
|
||||
el: '#api',
|
||||
methods: {
|
||||
testform: function() {
|
||||
var id=$("#id").val();
|
||||
var message=$("#message").val();
|
||||
console.log ("test "+id+" "+message);
|
||||
$.ajax ({ url: "/api/test/"+id, data: {msg: message}, method: "GET" }) .done (have_result) .fail (have_error);
|
||||
function have_result (res) {
|
||||
console.log (res);
|
||||
$("#res").text (res[0].message);
|
||||
}
|
||||
function have_error (err) {
|
||||
console.log ("error:");
|
||||
console.log (err);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- CDN_Vue.js minified lib -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user