开发者

Auto Submitting a Form

I am fooling around with Authorize.net and I have a problem I'm hoping someone could help me out with.

Basically I have a page which I have a form on that has all the pertinent information to send to Authorize.net for a purchase. All a user has to do is click a button on the page and i开发者_JAVA百科t POSTS all the info to get them to Authnet's hosted Payment Form.

Problem is I don't want them to have to click the button on my page to go to the payment form, I want it to be done automatically.

As for right now I'm using an archaic javascript function to submit the form (essentially pushing the button for the user).

<script type="text/javascript" language="javascript">
function submitform()
{
  document.myform.submit();
}

</script>

<BODY onload="submitform()">

I'm hoping I can skip this middle step so that when a user signs up with username password etc he/she is then sent to the payment form without actually having to travel to this middle page (even if only for a fraction of a second).

There is no need for user-interaction with this middle page and I have all the info I need to post to the Authorize.net already. I'm ok with jQuery and can send the POST request via an ajax call but that doesn't exactly put the user on the Authorize.net page. Or am I missing something.

Can someone give me a good way of solving this? There has to be a better way.


Use jQuery to send the POST request, like you mentioned. In your callback, if the POST was successful, redirect the user to the new page using window.location = "http://new-page".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜