Jump to content

Odd return data


Petty_Crim

Recommended Posts

I'm using the responsetext thing and am getting some odd returns. I'm sending form data to my javscript function which is then sending it to a .php file via GET. However while it outputs the values from my drop down lists it outputs nothing from my textboxes and text areas.

 

The odd thing is the form data works in passing it to the js function as i've been able to do document.writes and it outputs the correct stuff, the same is also true for passing non form data to my php file but for some reason the values from the text boxes are not being sent to the php file.

 

Does anyone know how to fix this?

 

JS Code:

function ajaxFunction(){
var ajaxRequest;  // The variable that makes Ajax possible!

try{
	// Opera 8.0+, Firefox, Safari
	ajaxRequest = new XMLHttpRequest();
} catch (e){
	// Internet Explorer Browsers
	try{
		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try{
			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e){
			// Something went wrong
			alert("Your browser broke!");
			return false;
		}
	}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 4 || ajaxRequest.readyState=="complete"){

		document.getElementById('text_loc').innerHTML = ajaxRequest.responseText;




	}
}

var member=document.getElementById('member').value;
var category = document.getElementById('category').value;
var description = document.getElementById('description').value; //text box thats not sending data to php file

var recruiter = document.getElementById('recruiter').value;
var date_timestamp = document.getElementById('date_timestamp').value;
var date_formatted = document.getElementById('date_formatted').value;


var table = document.getElementById('member_history');
var row = table.insertRow(1);
var cell_member, cell_date, cell_recruiter, cell_category, cell_description;
cell_member = row.insertCell(-1);
cell_member.appendChild(document.createTextNode(member));

cell_date = row.insertCell(-1);
cell_date.appendChild(document.createTextNode(date_formatted));

cell_recruiter = row.insertCell(-1);
cell_recruiter.appendChild(document.createTextNode(recruiter));

cell_category = row.insertCell(-1);
cell_category.appendChild(document.createTextNode(category));

cell_description = row.insertCell(-1);
cell_description.appendChild(document.createTextNode(description));

var sid=Math.random();

var queryString = "?triallee=" + triallee + "&date=" + date_timestamp + "&recruiter=" + recruiter + "&category=" + category + "&description" + description + "&sid=" + sid;
ajaxRequest.open("GET", "member_add.php" + queryString, true);
ajaxRequest.send(null); 
}

Link to comment
https://forums.phpfreaks.com/topic/83478-odd-return-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.