此代码无法正常工作。我想要的只是将变量发送$something到page.php
$something
page.php
正确的方法是什么?: data: <? php $something; ?>,
data: <? php $something; ?>,
脚本
$something = "text"; $.ajax({ url: "page.php", type: "post", dataType: "html", data: <? php $something; ?>, success: function (data) { $('#total').load('xxx.php'); } });
myFile.php:
<?php $something = 'text'; ?> <script> $.ajax({ url: "page.php", type: "post", dataType: "html", data: '<?php echo $something; ?>', success: function (data) { $('#total').load('xxx.php'); } }); </script>