gpt4 book ai didi

javascript - 如何在 React-native WebView 中捕获 form.submit 的响应

转载 作者:行者123 更新时间:2023-12-02 22:12:29 25 4
gpt4 key购买 nike

我的react-native应用程序中有一个WebView组件,可以使表单提交到外部API我正在寻找一种方法来捕获 form.submit 的响应,以便了解请求的状态并在我的应用程序中使用响应

<WebView source={{
html: '<BODY onload="document.forms[0].submit();"/>\n'+
'<FORM METHOD="post" ACTION="https://sbcheckout.payfort.com/FortAPI/paymentPage" id=form1 name=form1>\n' +
`<INPUT NAME="access_code" value="${access_code}">\n`+
`<INPUT NAME="language" value="${language}">\n` +
`<INPUT NAME="merchant_identifier" value="${merchant_identifier}">\n` +
`<INPUT NAME="merchant_reference" value="${merchant_reference}">\n` +
`<INPUT NAME="service_command" value="${service_command}">\n` +
`<INPUT NAME="card_number" value="${card_number}" >\n` +
`<INPUT NAME="expiry_date" value="${expiry_date}">\n` +
`<INPUT NAME="card_security_code" value="${card_security_code}">\n` +
`<INPUT NAME="signature" value=${signture}>\n` +
'\n' +
'<input type="submit" value="Submit">' +
'\n' +
'\t</form>'
}}
style={{ marginTop: 20 }}
/>

提前致谢

最佳答案

您将仅在 Web View 中捕获响应。您不会从 webview 中获取响应以本地化。在 native 应用程序中执行任务比打开 Web View 更好。正如我所看到的,您只是简单地使用表单数据,因此无需在 Web View 中打开此表单,而是仅在 React Native 中打开相同的表单并存储输出并在您想要使用的任何地方使用。

关于javascript - 如何在 React-native WebView 中捕获 form.submit 的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59516169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com