[Python] How do I get Python Post variables? [duplicate]

Discussão em 'Python' iniciado por Stack, Abril 14, 2025.

  1. Stack

    Stack Membro Participativo

    I am a PHP develeoper and I am trying to learn Pyhton. I thought a good place to start would be trying to do some basic things that I take for granted in PHP but I have stumbled quite early on.

    Using HTML as input I can send form values to PHP using JQUery. I can use the "$_POST" variable to retrieve those values in PHP.

    My JQuery and PHP code is as follows:

    function CallPHP (GHTok) {
    $.post('myphpfile.php', { Var1:GHTok },
    function(fud1)
    {
    jsVal1 = fud1.rtnVal1;
    alert(jsVal1);
    },"json");
    }



    <?php
    $phpVar1=$_POST['Var1'];
    echo json_encode(array("rtnVal1"=>$phpVar1.' - Success'));
    ?>


    I can call a python script in the same way but I can't seem to retrieve the values that have been posted by JQuery.

    Is there a way to do this in Python (v.3.13.3)?

    Any help greatly appreciated.

    Continue reading...

Compartilhe esta Página