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 @@ ...@@ -17,7 +17,7 @@
<select name="brasserie"> <select name="brasserie">
</select><br> </select><br>
<label for="file">Image</label> <label for="file">Image</label>
<input type="file" name="file"> <input type="file" name="file"><br>
<button id="send">Envoyer</button> <button id="send">Envoyer</button>
</form> </form>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// select, liste des brasseries
$.get( $.get(
"http://0.0.0.0:81/web/app_dev.php/API/v2/brasserie", "http://0.0.0.0:81/web/app_dev.php/API/v2/brasserie",
function(data){ function(data){
...@@ -39,6 +40,28 @@ $(document).ready(function() { ...@@ -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