Why doesn't this work?

R

Richard Trahan

Consider this code fragment:

print $q->header(-type => 'application/x-javascript');
print <<'EOF'
some_valid_js_1
some_valid_js_2
EOF

where $q is a CGI object. The above works ok.

Now change it to this:

print $q->header(-type => 'application/x-javascript');
print <<'EOF'
some_valid_js_1
EOF
print <<'EOF'
some_valid_js_2
EOF

In this case, neither line of js code gets to the destination page.
This behavior is the same for NN 7.1 and IE 6.0.

What am I doing wrong here?
 
R

Richard Trahan

(I'm answering my own post)

I forgot the g-d semicolon after the print statement.
A common error when using 'here' documents. Shame on me.
 
E

Evertjan.

Richard Trahan wrote on 10 aug 2004 in comp.lang.javascript:
Consider this code fragment:

print $q->header(-type => 'application/x-javascript');
print <<'EOF'
some_valid_js_1
some_valid_js_2
EOF

where $q is a CGI object. The above works ok.

Now change it to this:

print $q->header(-type => 'application/x-javascript');
print <<'EOF'
some_valid_js_1
EOF
print <<'EOF'
some_valid_js_2
EOF

In this case, neither line of js code gets to the destination page.
This behavior is the same for NN 7.1 and IE 6.0.

What am I doing wrong here?

Wrong NG ?

[Seems a different serverside language]
 
R

Randy Webb

Richard said:
What am I doing wrong here?

Not withstanding your own answer (the semicolon), your first problem is
you are assuming its a client issue when its a server issue.
The second is that you are asking about PHP code (presumably, it
resembles PHP) in a Javascript group. Try comp.lang.php or alt.php
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top