【发布时间】:2015-03-18 21:47:47
【问题描述】:
大家。 我有以下情况:
我有: http://example.com/ 和 http://example.com/new
在 example.com 中,我使用 fancybox iframe 在 example.com/new 域中加载了一些表单。
我的表单,基本上显示了一些字段供用户输入他的 pessoal 数据,如姓名、电话等......在他提交之后,我显示了一些来自数据库的用户协议条款和一个复选框供用户使用说他同意这些条款。
他检查并提交后,我想提醒一些成功消息和fancybox modal/iframe关闭,就是这样。
在表单页面中,我已经加载了 jquery 和 bootstrap。所以,当用户同意时,我打印:
<?php
echo "
<script>
alert('Some success message!');
$(document).ready(function(){
parent.$.fancybox.close();
});
</script>
";
?>
我有三种形式,一种有效,另两种我得到:
Error: Permission denied to access property '$'
有效的表格和其他两个之间的唯一区别是,在有效的表格中,我没有来自数据库的协议条款,只有复选框。
我可以将我的整个代码放在这里,但这将是一个巨大的问题。但是如果你们需要,我可以更新。
对不起我的英语,如果我不清楚,请原谅我。
更新:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<?php
/* Connect with DB */
require_once('require/conectar.php');
if(!empty($_POST))
foreach($_POST as $k => $v)
$$k = $v;
?>
<script type="text/javascript" src="http://example.com/new/assets/js/jquery.js"></script>
</head>
<body>
<?php if(!isset($agree) and !isset($next)): ?>
<h1>The form</h1>
<form method="post" action="">
<label>Your name:</label>
<input type="text" name="name">
<br>
<label>Your email:</label>
<input type="text" name="email">
<br>
<input type="submit" name="next">
</form>
<?php
else:
$error = (!isset($name)) ? true : false;
$error = (!isset($name)) ? true : false;
if($error)
{
echo '<script>You must fill all fields before submit.</script>';
exit;
}
$qrr = mysql_query("SELECT * FROM `terms`");
$terms = mysql_fetch_object($qrr);
?>
<h1>Terms:</h1>
<?php echo $terms->content; ?>
<form method="post" action="">
<input type="hidden" value="<?php echo $name; ?>" name="name">
<input type="hidden" value="<?php echo $email; ?>" name="email">
<input type="checkbox" value="1" name="accept"> I agree.
<input type="submit" name="agree">
</form>
<?php
endif;
if(isset($agree))
{
/*
Here i mail me the user data.
*/
echo "
<script>
alert('Soliciação Realizada com sucesso!');
$(document).ready(function(){
parent.$.fancybox.close();
});
</script>
";
}else
{
echo "<script>alert('You need to agree with the terms to proceed.');</script>";
}
?>
</body>
</html>
【问题讨论】:
-
根据所涉及的确切域,可能会或可能不会从另一个帧访问一个帧。
-
肯定还有其他区别,我们需要查看所有代码才能判断。看看您是否可以制作一个仍然导致问题的最小示例。当你剥离东西时,你可能会意识到是哪条线真正导致了它。
-
您需要发布导致问题的最小示例代码,否则您实际上是在让人们从数百种可能性中猜测问题可能是什么。
-
您的描述中缺少某些内容。听起来像 iframe,所以请确保一个不是
www.example.com,另一个没有www或httpvshttps
标签: javascript jquery twitter-bootstrap iframe