SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Jul 17, 2006, 21:22 #1
- Join Date
- May 2006
- Location
- Illinois
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Can't run Ajax file on another site..
Hello,
Recently, I created an Ajax application that reads off a PHP file and displays the auto-updated users online. When I tried my application on my site that it was hosted on, it ran fine, but as soon as I tried including the .js file on another site, nothing showed up.
The code that I used to include the .js file is:Code:<script type="text/javascript">var url='http://www.myspace-surveys.com';</script> <script type="text/javascript" src="http://www.phpmini.com/ajax/live.js"></script>
-
Jul 18, 2006, 00:40 #2
Httprequest calls can only be used to the same server as the page they're made from.
There is no way around this that I know of.Only dead fish go with the flow
-
Jul 18, 2006, 02:42 #3
- Join Date
- Nov 2005
- Location
- London, UK
- Posts
- 81
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can't run the AJAX on another site but you can write a little PHP script that grabs data for you from another site and returns it locally.
Perhaps something like this:
Code:function showNames(url) { var names = XMLHttpPost('/extract_names.php?url='+url); document.getElementById('something').innerHTML=names.join(' - '); }
-
Jul 18, 2006, 08:37 #4
- Join Date
- May 2006
- Location
- Illinois
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Okay, thanks for the help.
Bookmarks