Solved

best way to post form data to seperate domain

Posted on 2010-08-25
4
542 Views
Last Modified: 2013-11-11
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...


0
Comment
Question by:dog_star
4 Comments
 
LVL 4

Expert Comment

by:darkyin87
ID: 33522732
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 33524543
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
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33524681
0
 

Author Closing Comment

by:dog_star
ID: 33541145
i wasn't sure if you could post cross domain with jquery ajax, and i guess you can't... which would explain why none of my attempt worked...

i ended up posting with PHP though it took me ages as i'm new to PHP....

thanks for the help and suggestions
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now