Script not working
-
Hi,
I am trying to add the following script into my TEXT editor of wordpress on certain pages and it is not working. Any ideas? It works outside of wordpress, but once I put the code into a page the button no longer calls to the action.
<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.hostmamas.com/ClientExecutive/’;
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) {
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=0&productGroup=’ + groupId + ‘&domainName=’ + name_array[0] + ‘&tld=’ + name_array[1];
} else if ( domainStatus == ‘1’ ) {
window.location = ceURL + ‘order.php?step=0&productGroup=’ + groupId + ‘&domainName=’ + name_array[0] + ‘&tld=’ + name_array[1];
} else {
alert(‘there was an error, please try again later’);
}
}
}, ‘json’);
}
return false;
});
</script>
- The topic ‘Script not working’ is closed to new replies.