Javascript 在React-With Post HTTP请求中使用IFrame
我需要在我的组件的iFrame中打开一个外部系统小部件。 我正在使用React作为UI代码。 外部系统向我提供了一个POST请求,其中包含我需要发送的表单数据负载,然后在响应中我得到状态代码302(临时移动),在响应头“location”中我得到iFrame src的URL。 问题是它在POST调用之后被自动调用,所以当我将它分配给组件道具并从iFrame src调用它时,它是一个重复调用,我试图避免它。 在我从外部系统(jsp模拟器)获得的模拟器中,他们通过使用操作和目标iFrame填充表单属性来实现-Javascript 在React-With Post HTTP请求中使用IFrame,javascript,reactjs,iframe,Javascript,Reactjs,Iframe,我需要在我的组件的iFrame中打开一个外部系统小部件。 我正在使用React作为UI代码。 外部系统向我提供了一个POST请求,其中包含我需要发送的表单数据负载,然后在响应中我得到状态代码302(临时移动),在响应头“location”中我得到iFrame src的URL。 问题是它在POST调用之后被自动调用,所以当我将它分配给组件道具并从iFrame src调用它时,它是一个重复调用,我试图避免它。 在我从外部系统(jsp模拟器)获得的模拟器中,他们通过使用操作和目标iFrame填充表单属
<form id="data_form" action="SubmitInit.jsp" target="payment_frame" method="post">
及-
render(){
const{responseURL}=this.props;
返回(
);
}
我试着使用srcDoc,从自动呼叫中得到响应,但不起作用。
知道如何在iFrame中直接显示POST响应吗
componentWillMount() {
this.setIFrameContext();
}
setIFrameContext() {
const {customerId} = this.props;
const parentDomain = 'http://localhost:8091';
const reqData = {customerId, parentDomain};
this.props.dispatch(this.paymentActions.loadAddInstrumentScreen(reqData));
}
render() {
const {responseURL} = this.props;
return (
<div>
<iframe
name="payment_frame"
id="payment_frame"
src={responseURL} />
<br />
</div>
);
}