I am working on a website in Yii
. The situation is like this. In the website, the users
are provided a piece of code that is like this:
<iframe height="700" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="http://djoneclick.com/index.php?r=webservice/form&id=6b720ff1c3cdce6c278e784a3228fd9fadc6d864" title="" >
<a href="/index.php?r=webservice/form&id=6b720ff1c3cdce6c278e784a3228fd9fadc6d864" title="">
</a>
</iframe>
User
can embed this anywhere they want and take inquiries from the desired audience. This iframe
includes the src
which is a form
that submits to a controller
in Yii
. In the controller
, upon having a specif if
condition true
, it redirects
to the externel url
. It redirects but the contents of the url
(to which it is redirected) are displayed in the iframe
. What I want is to actually redirect
to that url
. I have spent hours upon R&D
for this but could not find any solution. any help?
$("#idForm").submit(function() {
var url = "path/to/your/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#idForm").serialize(), // serializes the form's elements.
success: function(data)
{
window.top.location.href = "http://www.yoursite.com";
}
});
return false; // avoid to execute the actual submit of the form.
});
Try this after the condition is true in your controller
:
echo "<script>";
echo "this.parent.location.href = '$externel_url'";
echo "</script>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.