getting post data and creating session variable in wordpress

admin

Administrator
Staff member
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

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