我使用以下代码:
$.ajax({
type:'GET',
url: 'save_desc.php?scrapbook_name=<?php print(addslashes($scrapbook_name)); ?>,
success: function(data){
$("#" + id + "below").html(data);
}
});
如何将其更改为通过发布而不是使用 $_GET 方法来发送敏感信息(带有“特殊”字符)?
注意:我尝试使用 addslashes
但这对传递带有通配符的字符串没有任何影响。
最佳答案
将 type
参数更改为“POST”,或者使用 jQuery 的 post()
函数:
$.post(
'save_desc.php',
{ scrapbook_name: <?php print(addslashes($scrapbook_name)) },
function(data) {
$("#" + id + "below").html(data);
}
);
关于php - 如何将 $_POST 信息发送到此页面而不通过提交表单访问该页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7167825/