Hello!
I would like to save the JavaScript variable to a web2py session
variable.
I have tried the following in my view (that has no controller
associated with it):
function submit_form(input_number, input_egn) {
$('input#user_input_number').val(input_number);
$('input#user_input_egn').val(input_egn);
$.ajax({
type: "POST",
data: "{game_id : $
('input#user_input_number').val(input_number)}"
success: function(msg){
alert( "Data Saved: " + msg );
}
});
{{session.game_id = 4}}
{{if request.vars['game_id']:
session.game_id = request.vars['game_id']}}
$('form:first').submit();
return false;
}
, but i receice the following error traceback:
1 Traceback (most recent call last):
2 File "/home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py", line 1064, in run
3 self.run_app(conn)
4 File "/home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py", line 1531, in run_app
5 self.environ = environ = self.build_environ(sock_file, conn)
6 File "/home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py", line 1363, in build_environ
7 request = self.read_request_line(sock_file)
8 File "/home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py", line 1138, in read_request_line
9 raise SocketTimeout("Socket timed out before request.")
10 SocketTimeout: Socket timed out before request.
I mean, does web2py has a way to RECEIVE JavaScript variables FROM
Python/web2py templates? Where are they stored? And how to call these
JavaScript variables inside {{ }} in a web2py view/template?
Thank you in advance for your answers!