"Bootstrap 3 Buttons check"
Bootstrap 3.1.0 Snippet by muhittinbudak

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Strait"> <body> <div class="container" style="font-family: 'Strait', sans-serif;"> <h2 class="text-center">Test</h2> <h4 class="text-center" id="sonuc">area</h4> <hr style="width:50%"> <div class="form-group row"> <div class="col-xs-10"> <input type="text" class="form-control input-lg" id="inputText" placeholder="#inputText"> </div> <div class="col-xs-2"> <button class="btn btn-danger btn-lg btn-block" id="tiklaBtn1">#tiklaBtn1</button> </div> </div> <span id="info" style="font-size:18px" class="label label-danger strait">#info</span> <span id="check" style="font-size:18px;cursor:pointer" class="label label-success strait">#check</span> <br/><br/> <div class="well well-lg text-success clearfix"> <span id="result" style="line-height:34px;font-size:20px">#result</span> </div> <div class="well well-lg text-success clearfix"> <span id="result1" style="line-height:34px;font-size:20px">#result1</span> </div> </div> </body>
$(document).ready(function () { var sonuc = $('#inputText').val(); /* $("#tiklaBtn1").click(function () { sonuc = !sonuc; if(sonuc){ bolum1("EVET"); } else { bolum2("HAYIR"); } }); */ function bolum1(text) { $("#result").html(text).css("color","red"); } function bolum2(text) { $("#result").html(text).css("color","green"); } //-------- Conditional (ternary) operator //https://www.geeksforgeeks.org/javascript/javascript-ternary-operator/ $("#tiklaBtn1").click(function () { ( sonuc=!sonuc ) ? bolum1("evet") : bolum2("hayır"); }); $("#check").click(function () { var url = "https://projeler.eu5.org/proxyrssntv1.php"; $("#result").html("checking...").css("color","red"); $.ajax({ url: url, method: "GET", // Sadece başlıkları alarak hızlı ve verimli kontrol yapar success: function() { // İstek başarılı olduysa (2xx durum kodları) $("#result").html("URL erişilebilir durumda.").css("color","green"); }, error: function(xhr, status, error) { // İstek başarısız olduysa (4xx, 5xx veya ağ hatası) let errorMessage = 'URL\'ye ulaşılamıyor. Lütfen URL\'yi kontrol edin.'; $("#result").html(errorMessage); if (xhr.status === 404) { errorMessage = 'URL bulunamadı (404 Not Found).'; $("#result").html(errorMessage); } else if (xhr.status > 0) { errorMessage = `Sunucu hatası: HTTP Status ${xhr.status}`; $("#result").html(errorMessage); } } }); }); // end check clik });

Related: See More


Questions / Comments: