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

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????

Yes, $_POST[] works in wordpress. To set session add session_start() at the beginnning of file ie after <?php line. Then set session variable by - $_SESSION['variable_name'] = "variable value"; ex: $_SESSION['my_num'] = 5;

Here session variable my_num is set to 5. To access this variable use

echo $_SESSION['my_num'];