Question : best way to post form data to seperate domain

hi,

i have a form which needs to be posted to a web service on another domain.

doing a straightforward post action like this :

<form action="http://xxx.com/ContactsWs.asmx/ContactEx_Add" method="post" enctype="application/x-www-form-urlencoded" id="reg1">

works fine, but the successful result is posted as a piece of XML code, so for the user it really doesn't look very good...

i've been trying to post the data using jquery .post and ajax but i can't seem to get it to work...

can someone please provide me with a full working example for submitting the form cross-domain and displaying the xml results.... if i can get this response data it should be easy enough to display a success/failure message depending on the response...


Answer : best way to post form data to seperate domain

You can't use AJAX, because of the javascript, to post to another domain.  The issue is "cross domain scripting" and browsers prevent it since it can lead to security issues and be used maliciously.

Is the domain one you control?  Is it on the same server?  Using your own server page to do the work is an alternative.  For example if the page is php then using curl can be a way to have your page work with the page on the other server.  

If you want details please let us know what language you can use.

bol
Random Solutions  
 
programming4us programming4us