{"id":611,"date":"2012-05-29T03:13:03","date_gmt":"2012-05-29T03:13:03","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=611"},"modified":"2012-05-29T03:13:03","modified_gmt":"2012-05-29T03:13:03","slug":"jquery-redirect-redirect-page-jquery-redirect-page-jquery-after-5-seconds","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/jquery-redirect-redirect-page-jquery-redirect-page-jquery-after-5-seconds\/","title":{"rendered":"jQuery Redirect Page After 5 Seconds Example"},"content":{"rendered":"<p><strong>Redirecting Page using jQuery<\/strong>\u00a0will help you to redirect to a page and this can be done with \u00a0help of just 1 line of code. Examples to page redirection using jQuery are provided. Read on to find out more on how to do this.<img decoding=\"async\" title=\"More...\" alt=\"\" src=\"https:\/\/theextremewebdesigns.com\/blog\/wp-includes\/js\/tinymce\/plugins\/wordpress\/img\/trans.gif\" \/><\/p>\n<h2>How to Redirect Page using jQuery &#8211; Examples<\/h2>\n<h3>Example 1: Redirect Page to another website without any delay using jQuery<\/h3>\n<pre class=\"lang:xhtml decode:true\">var url = \"http:\/\/www.theextremewebdesigns.com\";\n$(location).attr('href',url);<\/pre>\n<h3>Example 2: Redirect Page to a specific page of a website using jQuery<\/h3>\n<p>If you would rather redirect to a specific page of a website, use the following code:<\/p>\n<pre class=\"lang:xhtml decode:true\">var url = \"http:\/\/www.theextremewebdesigns.com\/services.php\";\n$(location).attr('href',url);<\/pre>\n<h3>Example 3: Redirect Page after 5 seconds using jQuery<\/h3>\n<p>If you would like to redirect to a website after a delay of 5 seconds, use the following code:<\/p>\n<pre class=\"lang:xhtml decode:true\">var url = \"http:\/\/www.theextremewebdesigns.com\";\n\n\/\/5000 is the number of milliseconds (or 5 seconds) that you want to wait before redirection.\nvar delay = 5000;\nsetTimeout(function() {\nwindow.location.href = url;\n}, delay);<\/pre>\n<h3>Example 4: Redirect Page on button click using jQuery<\/h3>\n<p>If you would like to redirect to a website after a delay of 5 seconds when a button is clicked, use the following code:<\/p>\n<pre class=\"lang:xhtml decode:true\">$(\"#my_button\").click(function()\n{\nvar url = \"http:\/\/www.theextremewebdesigns.com\";\n\/\/5000 is the number of milliseconds (or 5 seconds) that you want to wait before redirection.\nvar delay = 5000;\nsetTimeout(function() {\nwindow.location.href = url;\n}, delay);\n});<\/pre>\n<h5>That\u2019s it!<\/h5>\n<p>Do you know of any other ways to\u00a0<em><strong>redirect page using jQuery<\/strong><\/em>? Please feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redirecting Page using jQuery\u00a0will help you to redirect to a page and this can be done with \u00a0help of just 1 line of code. Examples to page redirection using jQuery are provided. Read on to find out more on how to do this. How to Redirect Page using jQuery &#8211; Examples Example 1: Redirect Page [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[29],"class_list":["post-611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","tag-tips-tricks"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-9R","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=611"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/611\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}