当前位置:Gxlcms > PHP教程 > ajax获取到的id数据,如何通过post方式提交该数据到post页面去。

ajax获取到的id数据,如何通过post方式提交该数据到post页面去。

时间:2021-07-01 10:21:17 帮助过:3人阅读

ajax获取到的id数据,如何通过post方式提交该数据到post页面去。



比如这样子的,如果id=“abc”里面显示的是:我们和你。。。
请问如何才能把我们和你这个值通过post方式提交给test.php处理页面去活得这个值


回复讨论(解决方案)

百度一下,ajax post请求很多的,我一般都是用jquery的ajax 很方便

$.ajax({
'type': 'POST',
'url':"createurl('ctrain')?>",
'cache': false,
'dataType' :"html",
'data':{"id":id},
'success': function(data) {
//data是返回的结果
$("#BgDiv").show();
$("#show_data").append(data);
}
});

jquery ajax好用

var abc = $("#abc").html();

$.post("test.php", { value: abc },
function(data){
//do
});

var abc = $("#abc").html();

$.post("test.php", { value: abc },
function(data){
//do
});

$(function(){

$("#tit").blur(function(){

$.ajax({

url:"check.php",
type:"GET",
data:"tit="+$("#tit").val(),
success: function(data)
{
$("#chk").html(data);
}

});
})

})

我这样子的,如何在test.php页面获得该数据呢。。

print_r($_GET);

人气教程排行