How do I add external domain search to my site

  • December 22, 2021
  • 0 Comments

If you want to add a domain availability search to your website, add the following code on your website, where you want the search to appear. 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<input id="domainname" type="text" name="domainname" value='yournewsite.com' />
<input id="submit-button" type="submit" value="Search Domain">
<script type="text/javascript">
  var ceURL = 'https://www.changeme.com/clientexec/';
  var groupId = 2;
  $('#submit-button').click(function(e) {
  e.preventDefault();
  var fullname = $('#domainname').val();
  if ( fullname.indexOf(".") == -1 ) {
  $('#domainname').addClass('domain_fail');
  $('#domainname').val(fullname+' - not a valid domain name');
  } else {
  name = fullname.substr(0, fullname.indexOf('.'));
  tld = fullname.substr(fullname.indexOf('.')+1);
  $.post(ceURL + 'index.php?fuse=clients&action=checkdomain',
  {
  name: name,
  tld: tld,
  group: groupId
  }, function(response) {
  console.log(response);
  if ( response.error ) {
  alert(response.message);
  } else {
  var domainStatus = response.search_results.status;
  if ( domainStatus == '0' ) {
  window.location = ceURL + 'order.php?step=1&productGroup=' + groupId + '&domainName=' + name + '&tld=' + tld;
  } else if ( domainStatus == '1' ) {
  window.location = ceURL + 'order.php?step=1&productGroup=' + groupId + '&domainName=' + name + '&tld=' + tld;
  } else {
  alert('there was an error, please try again later');
  }
  }
  }, 'json');
  }
  return false;
  });
</script>

If you want to change the default text displayed in the search box, modify this entry on the 2nd line.
<input id="domainname" type="text" name="domainname" value='yournewsite.com' />
You will need to input your domain and path to CE install on line 5.
var ceURL = 'http://yourdomain.com/path-to-your-install/';
Lastly, you will need to enter the domain product group in line 6.
var groupId = 2;

How helpful was this article to you?

Posting has been disabled.