{% extends "base.html" %}

{% block title %}
Dojo: Hello World!
{% endblock %}

{% block head %}
    <script type="text/javascript">
       // Load Dojo's code relating to the Button widget
       dojo.require("dijit.form.Button");
//       dojo.require("dojo.json");
    </script>
    <script>
           function helloCallback(data,ioArgs) {
//              arrayData = dojo.json.evalJson(data);
//              alert(arrayData[1]);
              alert(data);
           }
           function helloError(data, ioArgs) {
              alert('Error when retrieving data from the server!');
           }
    </script>
{% endblock %}

{% block content %}
<button dojoType="dijit.form.Button" id="helloButton">
        Hello World!
        <script type="dojo/method" event="onClick">
        dojo.xhrGet({
           url: '/get/target_location/',
           handleAs: "json",
           load: helloCallback,
           error: helloError,
           content: {name: dojo.byId('name').value }
        });
        </script>
</button>
Please enter your name: <input type="text" id="name">
{% endblock %}
