1

Topic: Python ajax parametrs

I try to pick up  a file on . It turns out without problems.
I try to add parameter:

$.ajax ({
url: "ajaxTest.py";
type: "POST";
data: {outputFormat: "pdf"},
success: function (result) {
console.log (result);
}
});

But in  a file

print (request.vars)

does not deduce anything. That I not so do!??

2

Re: Python ajax parametrs

Ajax request:

$(document).ready (function () {
console.log ("Document is ready!")
$.ajax ({
url: "ajaxTest.py";
type: "POST";
data: {outputFormat: "pdf"},
success: function (result) {
console.log (result);
}
});
});

ajaxTest.py:

#!/usr/local/bin/python3.5
print ("Content-type: text/html")
print ()
print ("Successful!!!!")
print (request. POST)

I receive only: Successful. request. POST gives nothing!

3

Re: Python ajax parametrs

What so anybody also does not know??

4

Re: Python ajax parametrs

Areostar;
Python Requests

5

Re: Python ajax parametrs

MikkiMouse;
I am familiar with it. But I speak about Ajax. That is if request from client side (html pages)

6

Re: Python ajax parametrs

Areostar;
Cgi unit is engaged in analysis of parameters

7

Re: Python ajax parametrs

Isokerf;
Thanks. Now I esteem.

8

Re: Python ajax parametrs

ajax request:

$.ajax ({
url: "ajaxTest.py";
type: "POST";
data: {outputFormat: "pdf"},
success: function (result) {
console.log (result);
}
});

ajaxTest.py:

import cgi, cgitb
form = cgi. FieldStorage ()
print (form)

I receive result:

wrote:

FieldStorage (None, None, [MiniFieldStorage (' outputFormat ', ' pdf ')])

Parameters  request always come in MiniFieldStorage and that two there do None

9

Re: Python ajax parametrs

Here so I receive the necessary parameter:

form.getvalue (' outputFormat ')

And here that it for two None yet did not understand!