Submit two forms with one button

后端 未结 7 1505
面向向阳花
面向向阳花 2020-11-22 04:20

I have HTML two forms, one that submits data upon entry to a database using PHP, the other directs the user to a paypal payment page, my problem is that the user would have

相关标签:
7条回答
  • 2020-11-22 05:00

    In Chrome and IE9 (and I'm guessing all other browsers too) only the latter will generate a socket connect, the first one will be discarded. (The browser detects this as both requests are sent within one JavaScript "timeslice" in your code above, and discards all but the last request.)

    If you instead have some event callback do the second submission (but before the reply is received), the socket of the first request will be cancelled. This is definitely nothing to recommend as the server in that case may well have handled your first request, but you will never know for sure.

    I recommend you use/generate a single request which you can transact server-side.

    0 讨论(0)
提交回复
热议问题