[Javascript] UTF-8 and AJAX
Peter Lauri
lists at dwsasia.com
Tue Aug 22 21:52:37 CDT 2006
Sorry, I was very tired yesterday when I wrote that. What I mean is that the
content that is coming back is not the text that they entered. With English
letters it works fine, but when involving Thai it doesn't work.
When I use AJAX to get Thai content that was submitted with regular post
method (not AJAX) it works fine. But when I use AJAX to get Thai content
that was submitted with AJAX GET method it does not work.
I do perform a UTF-8 encoding of the string before adding it to the URL that
is submitted with AJAX.
This is the code that I am using to push the information:
function teamCreateNew() {
createForm = document.forms["createnew"];
formName =
WebToolKit.utf8.encode(createForm.elements["name"].value);
formDescription =
WebToolKit.utf8.encode(createForm.elements["description"].value);
formInvite = createForm.elements["inviteonly"].checked;
geturl =
'teamajax.php?action=addteam&name='+formName+'&description='+formDescription
+'&inviteonly='+formInvite;
http.open('get', geturl);
http.onreadystatechange = teamHandleCreateNewResponse;
http.send(null);
createForm.elements["name"].value = "";
createForm.elements["description"].value = "";
}
The encoding is from the package:
http://www.webtoolkit.info/javascript/base64-encode-decode/
Is it more clear now?
/Peter
-----Original Message-----
From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]
On Behalf Of Scott Reynen
Sent: Tuesday, August 22, 2006 11:46 PM
To: [JavaScript List]
Subject: Re: [Javascript] UTF-8 and AJAX
On Aug 22, 2006, at 11:14 AM, Peter Lauri wrote:
> It works fine if I submit with traditional method, and then just
> get the data with AJAX. But when I try to do both with AJAX, it dies.
Can you define "dies" with more detail of exactly where you've
identified the problem?
Peace,
Scott
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list