dans ma page index.html, j'ai ajouté un appel à un script python (server.py) avec un paramètre "portnb". Comment le récupérer dans le script Python.
Voici le code ajax de la page hml:
Code : Tout sélectionner
function test22(portnb){
$.ajax({url: "action",
dataType : 'html',
type: "GET",
data: [b]portnb[/b],
success: function( strData2 ){;
$("#content3").html(strData2);
}
});
};
Voici une partie du code python(server.py):
Code : Tout sélectionner
Class Test3Handler(resource.Resource):
isLeaf = True
def __init__(self):
resource.Resource.__init__(self)
?????? comment récupérer la variable passée par Ajax et la mettre dans "retour
return retour
if __name__ == "__main__":
import sys
from twisted.internet import reactor
testHandler = TestHandler()
test2Handler = Test2Handler()
test3Handler = Test3Handler()
root = static.File('/home/pi/web3')
root.putChild('test', testHandler)
root.putChild('test2', test2Handler)
root.putChild('action', test3Handler)
reactor.listenTCP(8082, server.Site(root))
reactor.run()
Merci de votre aide.
Gilles