#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Send a form variable to php and back


    Hi! I want to send a variable from a html input to a php-document. The problem is that this php-document has to be on a remote server (not on the same domain). I have understood that i then need to use json or something. Can anyone point me in the right direction of how to do that? To be more precise: I have a html input in index.html on mydomain.com. I want to send the input to a test.php on thatdomain.com. Then i want to return a variable from test.php back to index.html to be used for something else. How?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    You can't do AJAX to another domain. So do an AJAX request to something on your own site which then send the request (and returns the response from) that other site.

    HTML form -> Javascript -> script on your site -> remote site -> script on your site -> Javascript

IMN logo majestic logo threadwatch logo seochat tools logo