Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

js removing space?

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
for some reason my code is removing spaces... how can i fix this?

I have outputed str and it returns test test so something is happening... do i need to encode it somehow?

heh

Code:
function addfolder() {
	var addfield = document.getElementById('addtextbox').value;
	if (addfield.length < 20) {
		
		var str = "foldername=" + addfield;
		var url2 = "/ajax/mail/save_folder.asp";
		alert(str); // outputs: "test test"
		xmlHttp=createRequestObject();
		xmlHttp.onreadystatechange = updateFolders;
		xmlHttp.open("POST",url2,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-[URL unfurl="true"]www-form-urlencoded;[/URL] charset=UTF-8");
		xmlHttp.send(str);
	} else {
		alert('Folder name must be less than 20 characters long.');	
	}
}

function updateFolders() {
    if (xmlHttp.readyState == 4) {
     	LoadFOLDERHtml('false');
		document.getElementById('addtextbox').value="";
		document.getElementById('addtextbox').focus();
	}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top