我想将哈希字符串发送到我的 php 文件。但失败了,有人可以帮助我吗?
我的 JavaScript 是这样的:
var hashString = "#support_form";
$.ajax ({
type: "POST",
url:"index.php",
data: hashString,
success: function() {
console.log("message sent!");
}
});
和 php:
<?php
$theHash = $_POST['hashString'];
?>
我该怎么办?谢谢
最佳答案
您需要指定数据的名称/值
data: {hashString:hashString},
关于php - 使用 jquery ajax 将字符串传递给 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14221680/