Forum Moderators: open
<script language="JavaScript" src="http://www.site.com/php/phpfeed/feed123js.php?src=http%3A%2F%2Fwww.feedURLsite.com%2Fabout%2Frss%2FfeedURLsite.rss&chan=n&num=2&desc=0&date=y&targ=y" type="text/javascript"></script>
<noscript>
<a href="http://www.site.com/php/phpfeed/feed123js.php?src=http%3A%2F%2Fwww.feedURLSite.com%2Fabout%2Frss%2Ffeedurlsite.rss&chan=n&num=2&desc=0&date=y&targ=y&html=y">View RSS feed</a>
</noscript>
Again , this code is placed directly in my html but I would like to save this code in a .js file and call it externally for faster page load.
Thanks
Since you're using PHP, why not use PHP includes?
<?php
include "http://www.site.com/php/phpfeed/feed123js.php?src=http%3A%2F%2Fwww.feedURLsite.com%2Fabout%2Frss%2FfeedURLsite.rss&chan=n&num=2&desc=0&date=y&targ=y";
?>
No Javascript required! :)
I did notice that the src= URI you are trying to include (just the cleaned up query string part) returns a "The page cannot be displayed", so maybe that has something to do with the success of this effort?
It looks like the problem may be in the syntax of the query string you are sending over to feedURLsite.com. Due to your prior use of the "?" query separator, you are precluded from using it in the src= value:
ttp://www.feedURLsite.com/about/rss/feedURLsite.rss&chan=n&num=2&desc=0&date=y&targ=y
should probably be:
ttp://www.feedURLsite.com/about/rss/feedURLsite.rss?chan=n&num=2&desc=0&date=y&targ=y
in order to work. Note the replacement of the "&" with a "?" following "feedURLsite.rss".
In addition, the your query string is being acted on by feed123js.php, like this:
ttp://www.site.com/php/phpfeed/feed123js.php
?src=http://www.feedURLsite.com/about/rss/feedURLsite.rss
&chan=n
&num=2
&desc=0
&date=y
&targ=y
So all you are sending to feedURLsite is its own page address, but none of the other parameters are making it.
How about using the proper query syntax to get the feed directly using a PHP include:
<?php
include "http://www.feedURLsite.com/about/rss/feedURLsite.rss?chan=n&num=2&desc=0&date=y&targ=y";
?>
Do you really need to use the feed123js.php file?