tetawebapp/templates/ajax.html

50 lines
2.5 KiB
HTML

{% extends "index.html" %}
{% block title %}Ajax{% endblock %}
{% block main %}
<section class='inline'>
<article class='left'>
<h3>Get HTML response from AJAX</h3>
<p>Click the refresh button to get the HTML response.</p>
<p>The response may randomly be a voluntary error so you should try it more than once.</p>
Refresh: <input type='button' class='refresh' value=' '
onclick='javascript:get_html_from_ajax(document.getElementById("html_container"), "/get_html_from_ajax");'>
</article>
<article class='right'>
<h3>Upload files with AJAX</h3>
<p>Select files to upload</p>
<p>The response may randomly be a voluntary error so you should try it more than once.</p>
Upload files:
<div class='file_upload'>
<!--
Input file is a tricky hack (see tetawebapp.css and tetawebapp.js)
-->
<input type='button' id='upload_icon_1' class='upload' title='Upload' value=' '/>
<input type='file' id='upload_input_1' multiple
title='Upload'
onchange='javascript:upload_file_from_ajax(this, "/upload", "TETA_ERR");'
onmouseover='javascript:lit(document.getElementById("upload_icon_1"));'
onmouseout='javascript:unlit(document.getElementById("upload_icon_1"));'/>
</div>
</article>
</section>
<hr/>
<article class='right' id='html_container'></article>
<hr/>
<section class='inline'>
<article class='left'>
<h3>Set value via AJAX</h3>
<p>Send value to the application.</p>
<p>If value is empty or is "We Make Porn" (case sensitive), an error is raised.</p>
<input type='text' id='value_sender'>
<input type='button' value="Try me" onclick='javascript:set_value_from_ajax(document.getElementById("value_sender"), "/set_value_from_ajax", "TETA_ERR");'>
</article>
<article class='right'>
<h3>Get value from AJAX</h3>
<p>Get a random value from the application.</p>
<p>Randomly raises a voluntary error so you should try it more than once.</p>
<input type='text' id='value_receiver'>
<input type='button' value="Try me" onclick='javascript:get_value_from_ajax(document.getElementById("value_receiver"), "/get_value_from_ajax", "TETA_ERR");'>
</article>
</section>
{% endblock %}