A simple question, find for a good while, leave a lesson in the time
In the beginning I used $ ("#textareaContents"). Text (); The text content, then remembered to textarea belong to form form, although <textarea name= "desc" cols= "rows=" "5" id= "desc" ></textarea> His writing is a closed (just like <div></div>) label, but the same as other form forms when getting text field values. val () get
Use $ (' #textareaContents '). Val (); Sure enough to get the value of the textarea.
var textareacontents = $ (' #textareaContents '). Val ();
In addition, when submitting to the background with Ajax, $.ajax ({
URL: "Userassess",
Type: "Post",
data:{textareacontents:textareacontents},//the ID of the first textareacontents value text box, submitted in jquery mode Ajax, this ID must be
DataType: "JSON",
Success:function (data) {}
According to the above Ajax submission, if you get the value of this textarea in the background, even if the text does not need to change the Chinese
No such transcoding is required, string textareacontents= new String (Request.getparameter ("textareacontents"). GetBytes ("Iso8859-1"), "Utf-8 ");
Directly with string textareacontents = Request.getparameter ("textareacontents"); it's okay.
TIP: Returns the JSON data don't forget to specify the return type Response.setcontenttype ("Application/json;charset=utf-8") in the background;
But if you submit a Chinese or ordinary href to a common form, you need to press the above transcoding.