在React提交表格后,iframe检查响应是否

发布于 2025-02-09 18:31:56 字数 785 浏览 0 评论 0原文

我一直在尝试将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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文