Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

best way to post form data to seperate domain

Posted on 2010-08-25
4
Medium Priority
?
551 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:darkyin87
ID: 33522732
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

721 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