I have a small problem to get jQuery post variables. So i have javascript file where is code bellow:
<script type="text/javascript">
$.post("view.php", { name: "John" } );
</script>
And i try to get that name "John" in view.php file like this:
<?php $variable = $_GET["name"]; ?>
And it wont get that name. Can someone please help me?
变量值不包含在$_GET
您可以在$_POST
找到它们
<?php $variable = $_POST["name"]; ?>
Since you've used '$.post' you must use the related action which will be $_POST. If you were using '$.get', then you would use your current method of $_GET.
使用$ _POST代替$ _GET ...
And you can use
<?php $variable = $_REQUEST['name']; ?>
if not shure how it should be get.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.