Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/creactiweb/_templates/templates/+package+/ajax.html
blob: f8d56217378718a787f01de7905b0352c9d26c0e (plain)
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
35
36
37
38
39
40
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: '/ajax',
            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 %}