how do you check for two parameters with jquery

Hi,

I'm trying to check the url for either "ID_xxxxx" or "CON_ID_xxxxxx"

The "x" is either a five or six figure number

This is what I have so far. Thanks for the help!

<script type="text/javascript">
        $(document).ready(function () {
            if(window.location.href.indexOf("ID" || "CON") > -1)
            {
                 alert("found it");
            }
			
        });
    </script>

Open in new window

smfmetro10Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
HainKurtConnect With a Mentor Sr. System AnalystCommented:
here it is if you need XXXXXX:
var url = window.location.href;
if (url.indexOf("ID_")>-1 || url.indexOf("CON_ID_") > -1)
{
  alert("found it");
  var num = url.replace("CON_ID_","").replace("ID_","");
  alert(num);
}

Open in new window

0
 
HainKurtSr. System AnalystCommented:
if(window.location.href.indexOf("ID" || "CON") > -1)

>>>

if ((window.location.href.indexOf("ID") > -1) || (window.location.href.indexOf("CON") > -1))
0
 
GaryCommented:
I assume you want the xxxxx part so what's an example url

(or maybe not)
0
 
smfmetro10Author Commented:
Ah - it would either be "ID_12345" or" CON_ID_123456"
0
 
smfmetro10Author Commented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.