call seperate website rpc with ajax

Discussion in 'JavaScript' started by klown, Oct 19, 2006.

  1. #1
    I currently have a ajax system working locally. Now i want to expand it so that people can call the rpc.php file on my website, and get information returned to theirs.

    What do i need to change to do this? I tried chmodding the rpc.php file to give all permissions, that didnt work.

    here is the call code

    var http = createRequestObject();
    
    function sndReq(action) {
        http.open('get', 'http://www.globalsurance.com/rpc.php?action='+action);
        http.onreadystatechange = handleResponse;
        http.send(null);
    }
    Code (markup):
    everything works to get to this location, and works after handle response. The response just isnt coming.

    The reponse should come as a echo statement like this echo
    echo "div|response to action";
    PHP:
    the java interprets this and places the info after the | into the divid named before the |.
     
    klown, Oct 19, 2006 IP
  2. JoshuaGross

    JoshuaGross Peon

    Messages:
    411
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can only call a server with AJAX if it's the server the HTML file is on.

    It can be a real pain...

    Edit: I think that's what you want to do anyway. What you can is give them a PHP file to put on their own server, to communicate with yours. The only other way is to use some weird Flash hacks: http://blog.monstuff.com/archives/000280.html
     
    JoshuaGross, Oct 19, 2006 IP