当前位置: 代码迷 >> PHP >> ajax获取到的id数据,怎么通过post方式提交该数据到post页面去
  详细解决方案

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

热度:329   发布时间:2016-04-28 20:31:55.0
ajax获取到的id数据,如何通过post方式提交该数据到post页面去。
ajax获取到的id数据,如何通过post方式提交该数据到post页面去。

<form id="form1" name="form1" method="post" action="test.php">

ajax通过id获取到的值显示:<div id="abc"></div>
  <input type="submit" name="Submit" value="提交" />

</form>

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

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

$.ajax({
                'type': 'POST',
                'url':"<?php echo $this->createurl('ctrain')?>",
                'cache': false,
                'dataType' :"html",
                'data':{"id":id},
                'success': function(data) {
                                        //data是返回的结果
$("#BgDiv").show();
$("#show_data").append(data);
                }
             });
  相关解决方案