使用JavaScript获取价值GET或POST变量? [英] Getting value GET OR POST variable using JavaScript?
本文介绍了使用JavaScript获取价值GET或POST变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用JavaScript获取页面加载时get或post变量的值?
How to get value of the get or post variable on page load using JavaScript?
推荐答案
你无法得到使用Javascript的POST变量的值,虽然您可以在服务器上处理请求时将其插入到文档中。
You can't get the value of POST variables using Javascript, although you can insert it in the document when you process the request on the server.
<script type="text/javascript">
window.some_variable = '<?=$_POST['some_value']?>'; // That's for a string
</script>
GET变量可通过 window.location.href $ c获得$ c>,有些框架甚至有方法准备好解析它们。
GET variables are available through the window.location.href
, and some frameworks even have methods ready to parse them.
这篇关于使用JavaScript获取价值GET或POST变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文