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
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to