External AJAX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RoryClapham
    New Member
    • Mar 2008
    • 10

    External AJAX

    Hi,

    I'm currently working on a project that has a script file (script.js) which uses an XMLHttpRequest to handle a local file (script.php). It opens the file, executes and then returns a value back to the Javascript file(ajax.respo nseText).

    When I link the script.js to an external website, such as my blog, the server can't find the file script.php, because it's not on my blog's server. The only way that I can make it find the file, is to include the entire URL to script.php, which works on the server, but not on my blog, because of the access control in most browsers stopping cross-domain AJAX.

    Is there any work-around?
  • jcumoletti
    New Member
    • Apr 2008
    • 6

    #2
    I dont believe so in javascript but as3 allows for cross-domain scripting as long as you set up a config file on the server you are trying to access

    Comment

    • RoryClapham
      New Member
      • Mar 2008
      • 10

      #3
      Hm.. any other way you can think of doing it?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Yes, you can using a web proxy. Basically, you send a request to a script on your domain, which passes the request to another domain (possible on the server-side, e.g. curl in PHP, cfhttp in Coldfusion, etc.) then the response is passed back to the client-side. There are security risks, so you shouldn't allow just any script to be run, only the ones you specify.

        Comment

        Working...