How to get Javascript variable from an HTML page?

后端 未结 2 795
花落未央
花落未央 2021-01-22 09:06

In the source code of a page on the internet, there is a Javascript variable containing JSON data that I would like to store in a variable in my PHP program.

Any idea ab

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-22 09:27

    Okay If you want to store that javascript variable in PHP then, you might have to send that variable to any PHP file using GET or POST method with ajax.

    you can send the var serializedForm = {"fields": ... } ; in ajax as a post or get method and in ajax.php file get this variable under $_POST or $_GET and save it to php variable.

提交回复
热议问题