Created
March 23, 2015 17:29
-
-
Save mgrandy/499ebfffc876d18480f2 to your computer and use it in GitHub Desktop.
CE External Domain Search with redirect to order the domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 = 'http://yourdomain.com/path-to-your-install/'; | |
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 { | |
var name_array = fullname.split('.'); | |
$.post(ceURL + 'index.php?fuse=clients&action=checkdomain', | |
{ | |
name: name_array[0], | |
tld: name_array[1], | |
group: groupId | |
}, function(response) { | |
if ( response.error ) { | |
alert(response.message); | |
} else { | |
window.location = ceURL + 'order.php?step=0&productGroup=' + groupId + '&domainName=' + name_array[0] + '&tld=' + name_array[1]; | |
} | |
}, 'json'); | |
} | |
return false; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment