Commit 31e7b647 authored by Mat's avatar Mat

submit du formulaire, avec souci au niveau de l'image ->

voir le x-debug, lien vers le profiler
parent d1215d45
......@@ -17,7 +17,7 @@
<select name="brasserie">
</select><br>
<label for="file">Image</label>
<input type="file" name="file">
<input type="file" name="file"><br>
<button id="send">Envoyer</button>
</form>
......@@ -27,6 +27,7 @@
<script>
$(document).ready(function() {
// select, liste des brasseries
$.get(
"http://0.0.0.0:81/web/app_dev.php/API/v2/brasserie",
function(data){
......@@ -39,6 +40,28 @@ $(document).ready(function() {
}
);
// submit du formulaire, en POST (create)
$('#send').click(function(e) {
e.preventDefault();
let form = $('#biere').serialize();
console.log(form);
$.ajax({
url: "http://0.0.0.0:81/web/app_dev.php/API/v2/biere",
method: 'POST',
data: form,
dataType: 'JSON',
success: function(data) {
console.log(data);
},
error: function(xhr) {
console.log(xhr);
}
});
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment