Using value passed to php by jQuery.getJSON

后端 未结 2 1943
忘了有多久
忘了有多久 2021-01-27 22:27

Could you handle the name \"John\" in php from this getJson()? Could you assign it to a php variable?

var output = [];
$.getJSON(\'DisplayMap.php\',{ Name: \"joh         


        
相关标签:
2条回答
  • 2021-01-27 23:11

    This code will cause a GET request to ./DisplayMap.php with a query string variable named Name set to the value of john:

    http://www.site.com/DisplayMap.php?Name=john
    

    In PHP, you would access this via $_GET['Name'] or $_REQUEST['Name'].

    As for the success function and what happens there, I don't really know what your system returns and it seems unrelated to your question.

    0 讨论(0)
  • 2021-01-27 23:17

    Since it will initiate a HTTP GET request, you can get variable in PHP as below

    $Name = $_GET["name"];
    
    0 讨论(0)
提交回复
热议问题