Redirect to a related page after an enquiry


Redirect to a new page using jQuery

You have a few related websites that garner quite a few visitors every day. You find that visitors to one website may also be interested in your other related portal.

So, you decide to redirect all those visitors who have posted an enquiry on your portal 1 to portal 2.

This is your original page

jQuery.ajax({
type: "POST",
url: "inquiry.php",
data: data,
success: function (html) 
{
jQuery("#thankyoupage").css("display","block");

}
});

You display a thank you message and after sometime you redirect the user to another page, transparently. The jQuery timeout function is used to achieve the required result.

When you add the following code just below the jQuery() call, the visitor is redirected to your other portal, after the "Thank you" message is displayed for 10 seconds.

// redirect to another page after 10 seconds
var ADDRESS ='https://www.myotherdomain.com/?source=ENQPG';
var delay = 10000; //delay in milliseconds
setTimeout(function(){ window.location = ADDRESS; }, delay);

The final code looks like this:

jQuery.ajax({
type: "POST",
url: "inquiry.php",
data: data,
success: function (html) 
{
jQuery("#thankyoupage").css("display","block");
// redirect to another page after 10 seconds
var ADDRESS ='https://www.myotherdomain.com/?source=ENQPG';
var delay = 10000; //delay in milliseconds
setTimeout(function(){ window.location = ADDRESS; }, delay);
}
});

The Benefits

There are two benefits to be accrued from this technique. One, all your serious visitors are introduced to your other portal resulting in more visibility. Your other site also gets increased number of visitors and moves up in search engine rankings.

No comments:

Two Reasons Google Ads Lead Form is Rejected

Two Reasons Google Ads Lead Form is Rejected An Investigation on Why the Google Ads Lead Form in My Google Ad Got Rejected. I just...

Most Popular

Copyrighted.com Registered & Protected DWYE-NHTO-NBNH-7FFM