如何通过jQuery/AJAX提交Authorize.Net DPM表单? [英] How Do I Submit an Authorize.Net DPM Form via jQuery/AJAX?

查看:113
本文介绍了如何通过jQuery/AJAX提交Authorize.Net DPM表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有了这个新的Authorize.Net DPM API.您创建一个HTML表单发布到Authorize.Net.然后,AuthNet调用中继响应脚本,也称为IPN(对于那些了解PayPal的人).然后,IPN脚本以HTML形式返回响应,例如重定向到错误或成功页面.

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.

好的,就是这样.但是现在我的雇主希望基于AuthNet发现不正确的任何内容(例如错误的到期日期)进行内联表单验证.是否可以将其包装到jQuery/AJAX中的$ .post()调用中,然后解析响应,而无需执行标准表单发布?

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?

推荐答案

您建议的内容违反了同源政策. http://en.wikipedia.org/wiki/Same-origin_policy

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.

我很recommend愧推荐IFrame作为任何解决方案.请记住,它们在老版本的移动浏览器上并不总是能很好地播放.

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

这篇关于如何通过jQuery/AJAX提交Authorize.Net DPM表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆