使用POST来加载的iframe页面 [英] load a page using POST to iframe

查看:713
本文介绍了使用POST来加载的iframe页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建与内部其他网页看到一个iframe。该网页是我的外域。通常我做这样的:

I want to create an iframe with other page visible inside. The page is outside my domain. Normally I do it like that:

$('<iframe />').attr('src','www.thepage.com?data=1').appendTo('body')

但是,如果 www.thepage.com 是通过POST而不是GET访问,我应该怎么加载呢? $阿贾克斯(类型:POST,...)。失败,因为原产地空不受访问控制 - 允许 - 产地允许的。

But if www.thepage.com is accessible via POST instead of GET, how should I load it? $.ajax( type:'POST',...) fails due to Origin null is not allowed by Access-Control-Allow-Origin.

推荐答案

在加载包含的字段形式的临时页面,你需要(隐藏),并使用JavaScript来提交表单。

Load in a temporary page that contains a form with the fields you need (hidden) and use Javascript to submit the form.

这恰好是previous问题,我问。 <一href="http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get">Response.Redirect与POST,而不是得到什么?

This happens to be a previous question that I asked. Response.Redirect with POST instead of Get?

看从帕夫洛答案。你可以看到他是怎么用,它提出一个对身体的负荷形式创建的HTML页面。

Look at the answer from Pavlo. You can see how he's creating an html page with a form that does a submit on load of the body.

这篇关于使用POST来加载的iframe页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆