SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    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>
    Thanks.
    Kyle Eagle
    President and CEO
    http://www.ewscorp.com

  2. #2
    SitePoint Addict dek's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    SitePoint Enthusiast
    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(' - ');
    }

  4. #4
    SitePoint Member
    Join Date
    May 2006
    Location
    Illinois
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, thanks for the help.
    Kyle Eagle
    President and CEO
    http://www.ewscorp.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •