rendered paste bodyfunction submitAssignForm(event,form){
var file = 'data.php';
var str = getFormValues(form,"validate");
xmlReq = getXML(file,str, function(xmlReq) {
if (xmlReq){
var response = xmlReq.responseXML;
var response_details = response.getElementsByTagName('response');
if (response_details.length > 0){
alert(response_details[0].getAttribute('user_id'));
alert(response_details[0].getAttribute('purchase_id'));
}
}
return false;
});
}
function getXML(file,str) {
var xhr = remoteRequestSetup();
if (xhr){
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status == 200) {
alert('should be working');
callback(xhr);
} else alert('Error code ' + xhr.status);
}
};
}
xhr.open( "POST", file, true );
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xhr.send(str);
return xhr;
}