Thread JS per JQuery in HTML einfügen funktioniert nicht (6 answers)
Opened by Hagen at 2010-06-06 13:20

GwenDragon
 2010-06-07 13:12
#138059 #138059
User since
2005-01-17
14554 Artikel
Admin1
[Homepage]
user image
Teste mal bitte das:

Code (html): (dl )
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
        <head>
                <meta http-equiv="content-type" content="text/html; charset=us-ascii">
                <script type="text/javascript" src="jquery-1.4.2.js"></script>
                <script type="text/javascript"><!--
                $(document).ready(function(){
                  $('#main').html('running...'); 
                  $('#change').click( 
                        function() {
                          $.get('/cgi-bin/ch.pl', function(data) { 
                                $('#main').html(data); 
                          } 
                          ); 
                        } 
                        );
                });
                // --> 
                </script>
                <title>Test for AJAX + CGI</title>
        </head>
        <body>
                <div id="main"></div>
                <a id="change" href="#" name="change">Change upper text</a>
        </body>
</html>


mit folgendem CGI ch.pl:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use strict;
use warnings;

use CGI qw(:all);

my $c = int rand(1000);

print header(),
        '--start--', "\n", 
        qq{ 
<script type="text/javascript">
alert($c);
</script> 
}, 
        "\$c ist $c", "\n", 
        '--ende--';


Bei mir geht das auf meinem Apache.
Last edited: 2010-06-07 13:13:35 +0200 (CEST)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread JS per JQuery in HTML einfügen funktioniert nicht