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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.