Question

There's this new Authorize.Net DPM API. You create an HTML form that posts to Authorize.Net. AuthNet then calls a relay response script, otherwise known as IPN (for those who know PayPal). The IPN script then returns a response back in the form of HTML, such as redirect to an error or success page.

Okay, fine, that's how it works. But now my employer wants inline form validation based on anything that AuthNet finds incorrect, like the wrong expiration date. Is it possible to wrap it up into a $.post() call in jQuery/AJAX and then parse the response, without doing a standard form post?

I tried this, but I kept getting cross-domain limitations. What's the trick?

Was it helpful?

Solution

What you are suggesting violates the same-origin policy. http://en.wikipedia.org/wiki/Same-origin_policy

However, it was suggested here (http://community.developer.authorize.net/t5/Integration-and-Testing/DPM-via-AJAX/td-p/26832) that you could hide the request in an iframe to avoid those issues.

I'm ashamed to recommend IFrames as a solution to anything. Remember, they don't always play nicely with older mobile browsers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top