ravemanhattan Posted April 30, 2009 Share Posted April 30, 2009 Hi, I am new to Ajax and I am stuck at a point where I have send the form details from one sever (html form) to another server(php file). I am using Ajax for posting the data till now to the server, but is it possible to use Ajax to send data from one server to another server. Please suggest me some techniques that can be used to work through this application. I would really apprecaite any suggestions regarding this issue. Thanks, ravemanhattan. Quote Link to comment https://forums.phpfreaks.com/topic/156265-how-to-send-data-from-one-server-to-another-server/ Share on other sites More sharing options...
Ken2k7 Posted April 30, 2009 Share Posted April 30, 2009 Not possible. You can use CURL. That's PHP-related, not JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/156265-how-to-send-data-from-one-server-to-another-server/#findComment-822642 Share on other sites More sharing options...
JonnoTheDev Posted May 12, 2009 Share Posted May 12, 2009 Yes you can do this. If you wanted to process the form data on another server then the form action parameter would simply point at the page i.e. <form action="http://www.xyz.com/process.php" method="post"> However if you want to do it with ajax then I suggest the accepted method on the remote server is GET so: // Ajax method req.open("GET", http://www.xyz.com/process.php?var1="+val1+"&var2="+val2); With this method you can also store the data on both servers with a second ajax request whereas using the using the form action parameter will send a user to the remote server. You would have to redirect them back. Quote Link to comment https://forums.phpfreaks.com/topic/156265-how-to-send-data-from-one-server-to-another-server/#findComment-832250 Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 I don't think any AJAX call works outside the realm of your own domain. Quote Link to comment https://forums.phpfreaks.com/topic/156265-how-to-send-data-from-one-server-to-another-server/#findComment-832383 Share on other sites More sharing options...
JonnoTheDev Posted May 12, 2009 Share Posted May 12, 2009 Wasn't aware of that thanks. However the Ajax call could initiate a server side script to post to a remote server. Quote Link to comment https://forums.phpfreaks.com/topic/156265-how-to-send-data-from-one-server-to-another-server/#findComment-832502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.