diff options
Diffstat (limited to 'templates/atoideweb/ajax.html')
-rw-r--r-- | templates/atoideweb/ajax.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/templates/atoideweb/ajax.html b/templates/atoideweb/ajax.html new file mode 100644 index 0000000..8eaaca6 --- /dev/null +++ b/templates/atoideweb/ajax.html @@ -0,0 +1,41 @@ +{% extends "layout.html" %} + +{% block content %} +<h1>{{ title }}</h1> + +<div id='ajax-sample' class='form'> + <h3>{{ _('ajax-sample') }}</h3> + <form method="post" action="/ajax" name="ajax-sample"> + <input type="radio" value="option 1" name="ajax-sample">option 1<br> + <input type="radio" value="option 2" name="ajax-sample">option 2<br> + </form> +<div> + +<script> +<!-- +$(document).ready(function() { + $("#ajax-sample input[type='radio']").change( function() { + $.ajax({ + url: '{{ action }}', + type: 'POST', + data: ({ 'ajax-sample' : $(this).val()}), + success: function(data) { + var _el = $('#ajax-sample-result'); + _el.html(data.result); + } + }); + }); +}); +--> +</script> + +<!-- HELPER WAY +{ options_ajax(_, 'ajax-sample', ['option 1', 'option 2'], '', '/ajax') } +--> + +<div id='ajax-result' class='result'> + <h3>{{ _('ajax-result') }}</h3> + => <span id="ajax-sample-result"></span> +</div> + +{% endblock %} |