Php 我如何才能在不提交表单的情况下将信息发布到此页面?
我正在使用以下代码:Php 我如何才能在不提交表单的情况下将信息发布到此页面?,php,javascript,ajax,get,Php,Javascript,Ajax,Get,我正在使用以下代码: $.ajax({ type:'GET', url: 'save_desc.php?scrapbook_name=<?php print(addslashes($scrapbook_name)); ?>, success: function(data){ $("#" + id + "below").html(data); } }); $.ajax({ 类型:'GET', url:'save_desc.php?剪贴簿_nam
$.ajax({
type:'GET',
url: 'save_desc.php?scrapbook_name=<?php print(addslashes($scrapbook_name)); ?>,
success: function(data){
$("#" + id + "below").html(data);
}
});
$.ajax({
类型:'GET',
url:'save_desc.php?剪贴簿_name=,
成功:功能(数据){
$(“#”+id+”下“).html(数据);
}
});
如何将此更改为通过发布而不是使用$GET方法发送敏感信息(带有“特殊”字符)
注意:我曾尝试使用
addslashes
,但这对使用通配符传递字符串没有任何影响。将类型
参数更改为“POST”,或者使用jQuery的POST()
函数:
$.post(
'save_desc.php',
{ scrapbook_name: <?php print(addslashes($scrapbook_name)) },
function(data) {
$("#" + id + "below").html(data);
}
);
$.post(
“save_desc.php”,
{剪贴簿名称:将类型
参数更改为'POST',或者使用jQuery的POST()
函数:
$.post(
'save_desc.php',
{ scrapbook_name: <?php print(addslashes($scrapbook_name)) },
function(data) {
$("#" + id + "below").html(data);
}
);
$.post(
“save_desc.php”,
{scrapbook_name:在RoccoC5的帖子注释之上,您可以使用jquery serialize函数生成一个变量,然后在帖子中使用该变量
var PostData = $(myform).serialize();
$.post("myphppage.php",
PostData,
function()
{
//completion code goes here
},
"html")
.error(alert("error with post"));
在RoccoC5的帖子注释之上,您可以使用jquery serialize函数将其转换为变量,然后在帖子中使用该变量
var PostData = $(myform).serialize();
$.post("myphppage.php",
PostData,
function()
{
//completion code goes here
},
"html")
.error(alert("error with post"));
不要使用addslashes,使用json_encode()
。addslashes用于数据库工作,而不是javascript生成。不要使用addslashes,使用json_encode()
。addslashes用于数据库工作,而不是javascript生成。;