Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. var typingTimer;                
  3. var doneTypingInterval = 1000;  //czas w milisekundach
  4.  
  5. //po naciśnięciu przycisku odliczaj
  6. $('#krs').keyup(function(){
  7.     clearTimeout(typingTimer);
  8.     if ($('#krs').val) {
  9.         typingTimer = setTimeout(function(){
  10.  
  11.              var v = $("#krs").val();
  12.             $("#frame").attr("src", "http://mrrandom.cba.pl/response.php?krs="+v);
  13. $('#frame').on("load", function() {
  14.    var z = document.getElementById("frame").contentWindow.location.href;
  15.    var decodedUri = decodeURIComponent(z);
  16.    var res = decodedUri.replace("http://mrrandom.cba.pl/", "");
  17.    substring = "pusto.php";
  18.    if (res.indexOf(substring) !== -1){
  19.        alert("Błędny numer KRS");
  20.        var re = "";
  21.        $('#nazwa').val(re);
  22.        $('#krs').val(re);
  23.    }
  24.    else {
  25.    $('#nazwa').val(res);
  26.    }
  27. });
  28.         }, doneTypingInterval);
  29.     }
  30. });
  31.    
  32. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement