1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
{% extends "::base.html.twig" %}
{% block title %}
Un test AJAX avec Symfony
{% endblock %}
ou est le {% block body %} {% endblock %} ???????
{% block javascripts %} ???????? N'est pas à la bonne place, non ?
{{ parent() }}
<h2>Test de la méthode AJAX</h2> // cette ligne est du HTML, que fait il dans le block JAVASCRIPT ????
Le coffre contient <div id="nbobjets"></div> objets actuellement. // cette ligne est du HTML, que fait il dans le block JAVASCRIPT ????
<script type="text/javascript">
$(document).ready(function()
{
$.ajax({
type:"POST",
data: "valeur = {{nombre_objets}}",
url:"{{ url('ajax_appli_coffre') }}",
cache: false,
success: function( msg ){
alert("retour ok"); // un teste de retour
}
});
}); /// il manquait ça !!
</script>
{% endblock %} |