javascript question

Below code work on http web site but it doesn't work on https web site?

I want to use it on https site?
which part of the code I should modify?

<script language="javascript" type="text/javascript">
      function updateData(v)
        var value=v.options[v.selectedIndex].value;
        $("#number").empty(); //empty "digit" drop down box
        if (value!="") //Ensure no empty value is submitted to server side
      function updateNumber(data)
        var numberData=jQuery.trim(data).split("\n");//split server side response by "\n"
        var number=document.getElementById("number");
        for (i=0;i<numberData.length;i++)
          value=numberData[i].split("-")[0];//get value from server response
          text=numberData[i].split("-")[1]; //get text from server response
          option=new Option(text,value);    //for better IE compatibility
          number.options[i]=option;         //
Who is Participating?
D PatelConnect With a Mentor D Patel, Software EngineerCommented:
You can use like below :

<script type="text/javascript">
  var protocol = (
      ("https:" == document.location.protocol) 
      ? "https" 
      : "http"
              + " src='"
                  + protocol 
                  + "://"
                  + "your.domain.tld"
                  + "/your/script.js"
              + "'"
              + " type='text/javascript'
          + "%3E"
          + "%3C/script%3E"
      ) // this HAS to be escaped, otherwise it would 
        // close the actual (not injected) <script> element

Open in new window

Ryan ChongCommented:
are you manage to debug in your web browser and check which part is not working?

for example, if you're using  FireFox, try press Ctrl + Shift + Q to inspecting.
BRMarketingAuthor Commented:
Dear D Patel,
I think "  or ' is missing,  ( quote or double quote is missing in the code )
could you please check that?
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

BRMarketingAuthor Commented:
Dear D Patel,
I'm sorry it didn't work.
+ " type='text/javascript' at the 20. line one double quote was missing,
I run the code, but it didn't work anyway
D PatelD Patel, Software EngineerCommented:
Replace that code with the below :

<script type="text/javascript" language="javascript">
    var fileref=document.createElement('script');
    fileref.setAttribute("src", document.location.protocol + '//');

Open in new window

BRMarketingAuthor Commented:
Dear D Patel,
I change the to my actual link,
but it didn't work anyway :(
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.