Fwd: Fwd: How to specify JSON parameters in CallBack?
Ethan Furman
ethan at stoneleaf.us
Sun Dec 13 12:54:20 EST 2020
From: Caleb Gattegno
Date: Fri, Dec 11, 2020 at 5:02 PM
Subject: How to specify JSON parameters in CallBack?
Please can you suggest where should I look for advice on converting a old style web app which vends whole pages of html
with a cgi-bin/python script invoked bypython3 server.py, into one that only serves callbacks to this Javascript AJAX
async RPC call:
$('#compute').click(function() {
$('#poly').val('Waiting...');
var seq = $('#seq').val();
console.log(seq);
$.post('/compute', seq, function(result) {
$('#poly').val(result.poly);
}, 'json');
});
I don’t want to touch the html/javascript, but I’d like to update the python cgi code module to respond to the RPC call
in the post by returning a json data structure. Poly is a string of variable length.
Many thanks
gattegnPython
More information about the Python-list
mailing list