I had this working at some point but it sttoped working and I can't figure out why.
Once I click button, modal will open with text loading... and nothing else is happening. I was able to see whois data for selected domain. This is what I should be able to see in modal: http://demo.whmcs.com/whois.php?domain=test.info
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Domain Checker</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
function viewWhois(domain) {
jQuery("#modalWhoisLoader").removeClass('hidden').show();
jQuery("#modalWhoisBody").hide();
jQuery("#whoisDomainName").html(domain);
jQuery("#modalWhois").modal('show');
jQuery.post("http://demo.whmcs.com/whois.php", "domain=" + domain,
function(data) {
jQuery("#modalWhoisBody").html(data);
jQuery("#modalWhoisLoader").hide();
jQuery("#modalWhoisBody").show();
});
}
</script>
</head>
<body>
<button type="button" onclick="viewWhois('test.info')" class="btn btn-default btn-sm">WHOIS</button>
<div class="modal fade" id="modalWhois">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="modalWhoisTitle">
WHOIS Results for <span id="whoisDomainName"></span>
</h4>
</div>
<div class="modal-body text-center hidden" id="modalWhoisLoader">
<p><i class="fa fa-spinner fa-spin"></i> Loading...</p>
</div>
<div class="modal-body" id="modalWhoisBody">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close Window
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
EDIT:
This is the correct code I'm using (I used http://demo.whmcs.com/whois.php
only for purpose of this question):
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
function viewWhois(domain) {
jQuery("#modalWhoisLoader").removeClass('hidden').show();
jQuery("#modalWhoisBody").hide();
jQuery("#whoisDomainName").html(domain);
jQuery("#modalWhois").modal('show');
jQuery.post("whois.php", "domain=" + domain,
function(data) {
jQuery("#modalWhoisBody").html(data);
jQuery("#modalWhoisLoader").hide();
jQuery("#modalWhoisBody").show();
});
}
</script>