Stuff (Tag: jquery)

Loading content from another domain using jQuery's load function

I was never aware before that you can not load content from external domains using jQuery's load function. I wanted to be able to load in a HTML stock ticker I had created into any website that I needed to display it on but could not.

Here is the solution I came up with:

I created a file "loadticker.php" and inside it put:

echo file_get_contents("http://www.myscript.com/path/to/file.php"); 

I put this file on the domain of every website I wanted to load the content to and set each page where I wanted to display the content to load the local file, "loadticker.php".

More of a workaround than a solution.

On the pages where I was already using PHP and I was loading in the ticker I skipped loading the file and just simply added:

echo file_get_contents("http://www.myscript.com/path/to/file.php"); 

Where I wanted to display the ticker.

By Rick Vause

Sub Navigation: