jquery ajax变量值设置为php变量

I parsed json with ajax. And I want to show that parsed value on same page. So that value set to php variable. And that php variable parse with using python. Also I don't want to parse with using php or python. Because, ajax parse process faster than php or python parse process. I did something like that:

sample.php


<?php 

if (isset($_GET['data'])){
    echo $_GET['data'];
}
else {

    ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
  $.ajax({
    url: 'http://ip.jsontest.com/', // example json
    type: 'GET',
    dataType: 'text',
    success: function(data) {
      var json_result = JSON.parse(data);
      //console.log(json_result); // The whole JSON
      window.location.href = "http://localhost/jsn/sample.php/?data="+data;
    }
  });
</script>

<?php
}
?>

dene.py

import requests
import pycurl
import urllib.request

c = pycurl.Curl()
c.setopt(c.URL, 'http://localhost/jsn/sample.php/')
# Follow redirect.
c.setopt(c.FOLLOWLOCATION, True)
c.perform()
c.close()

I can show data parsed by ajax. But I couldn't get value that data with python. How can I resolve that problem.