Bei mir funktioniert folgendes korrekt:
use CGI qw/:all/;
charset('utf-8');
print header;
print $_,': ',param($_),br for (param);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/js/jquery.js"></script>
<script language="javascript" type="text/javascript">
function speichern() {
$.ajax(
{
type: "post",
url: "/cgi/x.pl",
data: $("#form").serialize(),
success: function(msg) {
alert(msg);
},
error: function() {
alert('fehler');
}
});
}
</script>
<body>
<form action="/cgi/x.pl" method="post" enctype="application/x-www-form-urlencoded" name="form" id="form">
<input type="text" name="wert" id="wert" />
<input type="submit" name="submit" id="submit" value="Senden" />
<input type="button" name="button" id="button" value="Ajax" onclick="speichern();" />
</form>
</body></html>
Sowohl Perl-CGI als auch Ajax zeigen da Chinesisch, Deutsch, Russiches u. ä. korrekt an.
Last edited: 2011-12-27 15:07:39 +0100 (CET)