Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7697309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:58:56+00:00 2026-05-31T21:58:56+00:00

I have a url which could be www.website.com/order/?pg3=2 or www.website.com/orderstatus/?pg2= There could be several

  • 0

I have a url which could be www.website.com/order/?pg3=2
or www.website.com/orderstatus/?pg2=

There could be several combinations and numbers at the end, all i want to really do is check is pg2 or pg3 are empty?

Im not sure how to actually access the post variables in the url, sometimes the url might not have the variables at all tho ?

$(document).ready(function () {

  if(pg2 != ''){
    //Does a click
    $("#add2").click();
  }
  if(p3 != ''){
    $("#add3").click();
  }

});

how do i check if the pg2 is empty in javascript on the page load?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:58:57+00:00Added an answer on May 31, 2026 at 9:58 pm

    You can parse querystring with plain old js and then check if particular param populated
    The function below will give you a params array

      var queryString = window.location.href.replace(/^[^\?]+\??/,'');
    
    var params = parseQuery( queryString );
    function parseQuery ( query ) {
           var Params = new Object ();
           if ( ! query ) return Params; // return empty object
           var Pairs = query.split(/[;&]/);
           for ( var i = 0; i < Pairs.length; i++ ) {
              var KeyVal = Pairs[i].split('=');
              if ( ! KeyVal || KeyVal.length != 2 ) continue;
              var key = unescape( KeyVal[0] );
              var val = unescape( KeyVal[1] );
              val = val.replace(/\+/g, ' ');
              if ( ! Params[key] ) Params[key] = new Array ();
              Params[key].push( val );
           }
           return Params;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written regex to validate URL which could be either like google.com www.google.com
I have a website www.mysite.com running behind a load balancer. There are two servers
I have a URL which can be any of the following formats: http://example.com https://example.com
I have a url which has some get variables in it like: domain.com/recover?email=my@email.com&token=abc123 inside
I have a website which effectively displays a different site based on a URL
I have a url which have a response in Json lon=-0.1275&pg=0 I parsed the
Hi have this URL string which I need to extract possibly using regex but
I have the following URL which links to the product page of a Mac
I want to make customer route for url which have parameters. <a href='javascript:void(0)' onclick=window.location='<?php
In the sitemap file, I have sitemap Node URL which have more than 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.