PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
lazerbri
Forum Newbie
Posts: 15 Joined: Sat Dec 27, 2003 8:17 am
Post
by lazerbri » Sun Nov 21, 2004 9:31 am
Hi
I am experimenting with calling a PHP script from a html page using a Java script. Here's what I have so far
Code: Select all
<script language="javascript" src="http://www.mysite.com/test.php"></script>
and my test.php...
This keeps sending errors.
Other people are using this java script to call hit counter php scripts and it works fine. Anyone know why mine does not work and gives the error "Done, but with errors"?
Regards
Bri
peni
Forum Commoner
Posts: 34 Joined: Thu Nov 18, 2004 1:15 pm
Post
by peni » Sun Nov 21, 2004 9:49 am
1. never say "java" to "javascript"
2. of course, there's no js-command "hello". try putting into test.php:
Code: Select all
<?php
echo "document.write('ok');";
?>
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Nov 21, 2004 10:53 am
peni wrote: 1. never say "java" to "javascript"
2. of course, there's no js-command "hello". try putting into test.php:
Code: Select all
<?php
echo "document.write('ok');";
?>
As little I know about javascript this is not what he is after
Why even bother is javascript in the first place. You can include files in php via [php_man]include[/php_man] or [php_man]require[/php_man]
peni
Forum Commoner
Posts: 34 Joined: Thu Nov 18, 2004 1:15 pm
Post
by peni » Sun Nov 21, 2004 11:02 am
i fear he's speaking about (live) counters or sth. like that
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sun Nov 21, 2004 11:07 am
No matter what PHP will require a refresh, therefor eliminating the logic in using PHP for 'live' counters. Better off doing it completely in javascript if this is what hes after
Steveo31
Forum Contributor
Posts: 416 Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA
Post
by Steveo31 » Sun Nov 21, 2004 4:44 pm
header("Content-type: text/javascript");
Needed?