Aggiunto tempo.html

This commit is contained in:
antifaz 2013-09-15 16:33:38 +02:00
parent d54f8d9a7c
commit b786b405d2
4 changed files with 92 additions and 8 deletions

View file

@ -29,7 +29,7 @@ $(document).ready(function(){
<h1> techr*c </h1>
<h2> <a href="tempo.php"> macchina del tempo</a> </h2>
<h2> <a href="tempo.html"> macchina del tempo</a> </h2>
<div id="buttonscontainer"> </div>

View file

@ -21,7 +21,7 @@ var txt_start = "Inizia";
var txt_stop = "Ferma";
var txt_download = "Scarica";
var srvaddr = "http://127.0.1.1:8000/";
var srvaddr = "http://127.0.0.1:8000/";
var almostone = false;
var noplusbotton = true;
@ -101,6 +101,8 @@ function rec_new( ) {
event.preventDefault();
dataString = $(this).serialize();
alert("Mando:" + dataString);
RecAjax("/create", dataString);
/*
var request = $.ajax({
type: "POST",
cache: false,
@ -125,12 +127,37 @@ function rec_new( ) {
jqXHR.status, +"-"+ textStatus + "-" + errorThrown
);
});
*/
});
console.log("Form readyReady");
}
function RecAjax(apipath, dataString) {
var request = $.ajax({
type: "POST",
cache: false,
url: srvaddr + "/" + apipath,
data: dataString,
dataType: "json"
});
request.done( function(data) {
$.each(data, function(key, val) {
console.log("Key " + key + " > VAL " + val );
$("#"+trx_logarea( recid )).append( "Key " + key + " > VAL " + val + "<br>" );
});
console.log("Req OK: "+ data);
console.log("req"+ request);
} );
request.fail(function (jqXHR, textStatus, errorThrown){
console.error("The following error occured: "+
jqXHR.status, +"-"+ textStatus + "-" + errorThrown );
});
}
function ChangeState(eid, from, to) {
console.log("ChangeState: " + from + " --> " + to );

57
client/tempo.html Normal file
View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title> TechREC </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/reclibrary.js"></script>
<script>
/*
TODO:
prendere lo stato !!!
*/
$(document).ready(function(){
$("#searchform").submit(
function () {
alert("Submit");
});
});
</script>
</head>
<body>
<div id="pagecontainer">
<h1> techr*c </h1>
<h2> <a href="index.html"> Nuova registrazione</a> </h2>
<div id="buttonscontainer">
<form action="#" method="POST" id="searchform">
<input type="text" name="search" />
<input type="text" id="starttime" name="starttime" placeholder="Start: 2014-05-01-44-55-01" />
<input type="text" id="endtime" name="endtime" placeholder="End: 2014-05-01-44-55-01" />
</form>
</div>
<div id="searchresult">
</div>
</div>
<div id="footer">
techbl*c
</div>
</body>
</html>

View file

@ -20,11 +20,11 @@ class RecServer:
# @hook('after_request')
def enable_cors(self):
#These lines are needed for avoiding the "Access-Control-Allow-Origin" errors
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS'
response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
#These lines are needed for avoiding the "Access-Control-Allow-Origin" errors
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS'
response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
def _route(self):
self._app.route('/favicon.ico', callback=self.favicon)