How Do I Submit an Authorize.Net DPM Form via jQuery/AJAX?

北城余情 提交于 2019-12-12 02:19:54

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/15873074/how-do-i-submit-an-authorize-net-dpm-form-via-jquery-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!