doulian8554
doulian8554
2013-12-02 07:25

获取发布数据并在wordpress中创建会话变量

  • wordpress
  • session
  • php
  • ajax

hi I am new to wordpress. I have few problems fromlong while. What I am trying to do is.. I have put some normal javascript code to send post data using AJAX..which is fine I have tested them out side wordpress but what I have to do is getting data in wordpress and storing themin wordpress session..a part of javascript code like

function purchase(img, price){
xmlHttp=CreateXmlHttpObject()
  if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
  var url="http://www.example.com/purchase.php";
  xmlHttp.onreadystatechange=setTimeout(function(){stateChanged();}, 300)  ;
  xmlHttp.open("POST",url,true);
  xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  xmlHttp.send("image="+img+"&price="+price);
}

so please help me..how I get this data in wordpress and most important how do I store them in wordpress session. does normal $_POST works in wordpress????

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐