Jump to content

lee2121

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by lee2121

  1. Hello, If i run the following code in an ASP page it loads the file (stored on local server) and outputs the text as expected;

    <p id="demo"></p>
    
    <button type="button" onclick="loadDoc()">Load Feed</button>
    
    <script>
    function loadDoc() {
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
          document.getElementById("demo").innerHTML =
          this.responseText;
        }
      };
      xhttp.open("GET", "XML_TEST.xml", true);
      xhttp.send();
    }
    </script>


    I need to run this from a URL not a local file. The URL has the exact same data and if i run the URL in a browser i get the data displayed in XML in the browser but when i change my code to fetch the data from the URL nothing happens.

    <script>
    function loadDoc() {
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
          document.getElementById("demo").innerHTML =
          this.responseText;
        }
      };
      xhttp.open("GET", "https://test.httpapi.com/api/domains/available.xml?auth-userid=user&api-key=key&domain-name=domain&domain-name=domain2&tlds=com&tlds=co.uk", true);
      xhttp.send();
    }
    </script>
    

    any ideas please how i can get this to work?

  2. Does anybody know how this calculation can be changed into KG's not llb's it calculates BMI

     

    //BMI Form Validation... $('form.dt-sc-bmi-frm').each(function(){ $(this).validate({ rules: { txtfeet: { required: true }, txtinches: { required: true }, txtlbs: { required: true } }, errorPlacement: function(error, element) { } }); }); //BMI Calculation... $('form[name=frmbmi]').submit(function(){ var This = $(this); if(This.valid()) { var fet = This.find('input[name=txtfeet]').val(); var inc = This.find('input[name=txtinches]').val(); var tinc = ( parseInt(fet) * 12 ) + parseInt(inc); var lbs = This.find('input[name=txtlbs]').val(); var bmi = ( parseFloat(lbs) / (tinc * tinc) ) * 703; This.find('input[name=txtbmi]').val(parseFloat(bmi).toFixed(1)); } return false; }); //BMI View... if($("a.fancyInline").length) { $("a.fancyInline").fancybox({ scrolling: 'no', width: 'auto', height: 'auto' }); }

×
×
  • Create New...