Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.     function checkDomainName() {
  3.         var retval = false;
  4.  
  5.         if ($('#DomainName').val() == '') {
  6.             $("#availabilityMessage").addClass("MSG Warning").html('Please enter a Domain Name.');
  7.  
  8.             return retval;
  9.         }
  10.  
  11.         if (!/^([a-zA-Z0-9\-]+)$/.test($('#DomainName').val())) {
  12.             $("#availabilityMessage").addClass("MSG Warning").html('Invalid characters in your prefix.').show();
  13.  
  14.             return retval;
  15.         }
  16.  
  17.         $("#availabilityMessage").html("Checking...");
  18.         $.post('/Enroll/Signup/CheckUrlAvailability', { subdomain: $('#DomainName').val() }, function (results) {
  19.             if (results.isAvailable) {
  20.                 $("#availabilityMessage").addClass("MSG Success").html('That url is available!');
  21.                    
  22.                 retval = true;
  23.             }
  24.             else
  25.                 $("#availabilityMessage").addClass("MSG Warning").html('That url is not available.');
  26.  
  27.             return retval;
  28.         });
  29.     }
  30.  
  31.     $('#checkUrlAvailability').click(function (e) {
  32.         e.preventDefault();
  33.  
  34.         checkDomainName();
  35.     });
  36.  
  37.     function submitForm(e) {
  38.         e.preventDefault();
  39.         if (checkDomainName())
  40.             $("#SubscriptionForm").submit();
  41.     }
  42.  
  43. //            $("#submit").click(function (e) {
  44. //                e.preventDefault();
  45.  
  46. //                if (checkDomainName()) {
  47. //                    alert('hello');
  48. //                    $("#SubscriptionForm").submit();
  49. //                }
  50. //            });
  51. });
  52.  
  53. //                if ($('#DomainName').val() == '') {
  54. //                    $("#availabilityMessage").addClass("MSG Warning").html('Please enter a Domain Name.');
  55. //                    return;
  56. //                }
  57.  
  58. //                if (!/^([a-zA-Z0-9\-]+)$/.test($('#DomainName').val())) {
  59. //                    $("#availabilityMessage").addClass("MSG Warning").html('Invalid characters in your Domain Name.').show();
  60. //                    return;
  61. //                }
  62.  
  63. //                $("#availabilityMessage").html("Checking...");
  64. //                $.post('/Enroll/Signup/CheckUrlAvailability', { subdomain: $('#DomainName').val() }, function (results) {
  65. //                    if (results.isAvailable) {
  66. //                        $("#availabilityMessage").addClass("MSG Success").html("That url is available!");
  67. //                        $("#SubscriptionForm").submit();
  68. //                    }
  69. //                    else
  70. //                        $("#availabilityMessage").addClass("MSG Warning").html("That url is not available.");
  71. //                });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement