Page 1 of 1

URL problem

PostPosted: 24. March 2011 05:42
by ck330
Hi, I have problem when I test program in XAMPP (Lite 1.7.3) and Windows XP.

The test.php refreshes a new random number every 10 seconds from count.php. It works well when 2 files is located in local server, but it cannot refreshes a new random number if test.php is located in local server and count.php file is located in web hosting server (not local server).

I've searched the solution and try to test it again and again; including edit php.ini "allow_url_include = On", but it also cannot refresh a new number. Please help me, thank you!

test.php
Code: Select all
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script>
var auto_refresh = setInterval(function() {
   $('#load_num').fadeOut('fast').load('http://www.abc.com/count.php').fadeIn("fast");
}, 10000);
</script>
</head>
<body>

<div id="load_num">7</div>

</body>
</html>


count.php
Code: Select all
<?PHP
echo rand(5, 15);
?>

Re: URL problem

PostPosted: 24. March 2011 06:13
by Sharley
Code: Select all
<script></script>
Tells the server or the browser nothing, it is an incorrect tag that requires a script 'type' attribute, but not sure until you correct it if it is related to your issue.
Code: Select all
<script type="text/javascript"></script>
would be a very simple correction but read the manual about HTML tags to get the full picture and http://validator.w3.org/#validate_by_input may be a good place to start for check out your code for correctness (I see a few errors in red when I copy and paste your code in the link above).

Re: URL problem

PostPosted: 04. April 2011 14:25
by ck330
Sharley wrote:
Code: Select all
<script></script>
Tells the server or the browser nothing, it is an incorrect tag that requires a script 'type' attribute, but not sure until you correct it if it is related to your issue.
Code: Select all
<script type="text/javascript"></script>
would be a very simple correction but read the manual about HTML tags to get the full picture and http://validator.w3.org/#validate_by_input may be a good place to start for check out your code for correctness (I see a few errors in red when I copy and paste your code in the link above).


The problem may be that jQuery does not allow cross domain.

Thank you, Sharley!