A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
HTML, CSS and JavaScript
Author
Passing UTF-8 data to servlet through AJAX
Mohamed Shehab
Greenhorn
Joined: Feb 15, 2009
Posts: 4
posted
Jan 09, 2010 22:01:07
0
I have an AJAX JavaScript function, I want to pass UTF-8 data to insert to Oracle database, the function is working perfectly for ASCII data, but while passing UTF-8 data, it is not working. This is my code snippet:
function insertClob() { var contentType = "application/x-www-form-urlencoded;charset=utf-8"; var body = document.getElementById('body').value; if(xmlhttp) { xmlhttp.open("POST","/Project1/CLobServlet?action=insert&body="+body ,true); xmlhttp.onreadystatechange = insertClobCallback; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.overrideMimeType('text/html; charset=UTF-8'); //xmlhttp.setRequestHeader('Content-Type', contentType) xmlhttp.send(null); } }
Can anyone advise me please ?
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
I like...
posted
Jan 09, 2010 22:40:06
0
Dupe of
this
. Please don't post the same question in multiple forums. Closing this one...
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Passing UTF-8 data to servlet through AJAX
Similar Threads
Passing UTF-8 data to servlet through AJAX
Problem with UTF-8 Character encoding
Displaying a Greeting message using Ajax
Problem with POST in ajax
ajax-jsp special characters like %,&
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter