Sometimes it may be needed that you need to give a close link in the popup you created. We have shared the function for how to close the popup in jQuery after submitting the form.
If you want to track conversion of contact us page by defining its Thank You page then also this function will help you.
If you want to redirect the page to somewhere else then use this function like this:
Core PHP
_redirectJs(‘dashboard.php’)
Codeigniter
_redirectJs(‘controller/function’) OR
if you have defined url in route file
_redirectJs(‘dashboard’)
jquery function is as follows:
function _redirectJs($tourl = ”) {
if ($tourl == ”) {
$tourl = ‘home’;
}
$script = ‘<script type=”text/java
script”>
var local = location.pathname.split(“/”);
local.pop(); // remove the filename
local.push(\”.$tourl.’\’);
local = location.protocol+”//”+location.hostname+””+local.join(“/”);
top.location.href = local;
</script>
‘;
echo $script;
//code
}
Related Posts...
CSSPHPTechnologiesWeb Design
Jun 26th, 2025
The year is 2025, and the landscape of software development is buzzing with innovation. Amidst this rapid evolution, one tool stands out as a true game-changer: GitHub Copilot. What started […]
Read more
Jun 24th, 2025
Artificial Intelligence (AI) is no longer a futuristic concept. From chatbots answering customer queries to language models assisting developers with code generation, AI has firmly embedded itself in our digital […]
Read more
May 29th, 2025
Choosing the right programming language can make all the difference — whether you’re building cutting-edge AI, launching a startup, or simply looking to future-proof your skills. The year 2025 has […]
Read more