ajax跨域提交

ajax

2013-10-06 16:04

ajax   a.qq.com  提交到 b.qq.com   (Jquery)


a.qq.com

  1. html

<script>xbyx(7);</script>

function xbyx(id){

wodexb=$("#listshow").html();                     //获取的内容

$.post("0.php", { data:wodexb, page:id },         //提交到 a.qq.com/0.php

   function(data){

    $("#fhjg").html(data);

   });

}



0.php

<form id="form1" name="form1" method="post" action="http://b.qq.com/1.php?ad=da" target="page">

 <label>

 <textarea name="data" id="data"><?=$_POST['data']?></textarea>

<input name="p" type="text" value="<?=$_POST['page']?>" />

 </label><input name=""  type="submit" value="1" />

</form>

<script language="javascript">

setTimeout(document.getElementById("form1").submit(),3000);

</script>

<iframe src="" width="0" height="0" name="page"></iframe>

----------------------------------------------------------------------------------

b.qq.com

1.php 

if ($_GET['ad']=="da"){

正常操作入库等等。。。

}