v0.0.8 Ajax now works with backend
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
$("#submit").click(function(){
|
||||
var $title = $("#title");
|
||||
var $description = $("#description");
|
||||
|
||||
|
||||
var data = {
|
||||
title: $title.val(),
|
||||
description: $description.val(),
|
||||
title: $("#title").val(),
|
||||
description: $("#description").val(),
|
||||
};
|
||||
|
||||
console.log(data);
|
||||
|
||||
$.ajax({
|
||||
url: '../Backend/controller/upload.php',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function () {
|
||||
console.log("Dansker bingo")
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
},
|
||||
error: function () {
|
||||
console.log("error");
|
||||
|
||||
@@ -13,6 +13,4 @@ $( document ).ready(function() {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
+3
-3
@@ -34,8 +34,8 @@ use Backend\Model\Post;
|
||||
<hr>
|
||||
<p>Opret post</p>
|
||||
<!--<form action="../Backend/controller/upload.php" method="POST">-->
|
||||
<input type="text" id="title" name="title">
|
||||
<input type="text" id="description" name="description">
|
||||
<input type="text" id="title" name="title" maxlength="255">
|
||||
<input type="text" id="description" name="description" maxlength="2000">
|
||||
<button id="submit" name="createPost">Opret opslag</button>
|
||||
<!-- </form>-->
|
||||
<hr>
|
||||
@@ -49,4 +49,4 @@ use Backend\Model\Post;
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user