Jquery how to validate domain name
<p>I have a input field where users can write a domain name that they  wish for search for. </p>

<p>My domain search only support searches as: "something.com"  or "something" </p>

<p>And it only support <code>.com, .net, .org</code></p>

<p>That I want to do is validate the user input before the ajax call is made and display an error message if anything is wrong. Example if a user types: "asdasdasd.asdasd" or "wwwasd.asdasd" or "www.asdasd.dk"</p>

<pre><code>#domainsearch is the input field

#domanerknap is the search button
</code></pre>

<p>Here is my Jquery:</p>

<pre><code>$(document).ready(function() {
    $('#domanerknap').click(function(e) {
        var doma = $('#domainsearch').val();
        $('#contentajax').empty()
                         .css("border", "1px solid #CCCCCC")
                         .html('&lt;p class="vent"&gt;Please wait...&lt;/p&gt;&lt;p class="venter"&gt;&lt;img src="../images/ajax.gif" /&gt;&lt;/p&gt;');
        $.ajax({
            type: 'POST',
            url: 'http://localhost:3000/domain',
            data: {
                domain: doma
            },
            success: function(msg){
                $('#contentajax').html(msg);
                $('#contentajax').css("border", "none");
            }
        });        
    });
});
</code></pre>
