在React提交表格后,iframe检查响应是否
我一直在尝试将iframe嵌入我的React JS项目中。我面临的问题是,iframe的来源是向我返回HTML表格的外部URL,然后当我提交该表格时,他们触发了自己的API以验证数据并返回HTML以获得成功或失败。
因此,我需要访问某些特定的className,以了解我的响应是否成功
alert-success for success response
alert-failure for failed response
是我的代码下面的代码,
<iframe
id="one"
src={`https://xxxxxxxxx.com/Payments/xxxxxx?id=12232331&pais=pt&aseguradora=dg&nombre=CustomerName&apellidos=CustomerSurname&codPostal=CustomerPostalCode`}
width="100%"
height="300"
></iframe>
现在我该如何访问className以找到该形式的响应,或者是否还有其他解决方法这 ?
尝试var iframe = document.getElementsbytagname(“ iframe”)[0];
,
但随后我在此处或提交表单后都无法访问任何类名称(用于警报 - 核对仪或警报失败)
I have been trying to embed Iframe in my react js project. The issue i am facing is that the source of Iframe is an external url which returns HTML form to me and then when i submit that form, they hit their own api to validate data and return HTML for success or failure.
So i need to access some specific classnames in order to know whether my response is successfull or not like
alert-success for success response
alert-failure for failed response
This is my code below for that
<iframe
id="one"
src={`https://xxxxxxxxx.com/Payments/xxxxxx?id=12232331&pais=pt&aseguradora=dg&nombre=CustomerName&apellidos=CustomerSurname&codPostal=CustomerPostalCode`}
width="100%"
height="300"
></iframe>
Now how can i access the classname in order to find response for that form, or is there any other workaround for this ?
tried var iframe = document.getElementsByTagName("iframe")[0];
but then I cannot access any classnames here or even after submitting the form (for alert-success or alert failure)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论