I'd like to learn how data is passed form one file to another and then displaying at when an error occurs.
I have this php script that checks if an domain really exist phpfile: check_domain.php list($userName, $hostName) = split("@", $request); // Function to check whether a given hostName is a valid email // domain address. function myCheckDNSRR($hostName, $recType = '') { if(!empty($hostName)) { if( $recType == '' ) $recType = "MX"; exec("nslookup -type=$recType $hostName", $result); // check each line to find the one that starts with the host // name. If it exists then the function succeeded. foreach ($result as $line) { if(eregi("^$hostName",$line)) { return true; } } // otherwise there was no mail handler for the domain return false; } return false; } $valid = 'false'; // If you are running this test on a Windows machine, you'll need to // uncomment the next line and comment out the checkdnsrr call: if (myCheckDNSRR($hostName,"MX")) //if (checkdnsrr($hostName,"MX")) $valid = 'true'; else $valid = 'false'; echo $valid; ?> It splits an email address into two parts, $userName and $hostName. But only $hostName is used for the domain check. javascript: <script type="text/JavaScript"> $(document).ready(function () { $("#test").validate({ rules: { email: { required: true, email: true, remote: "domain_check.php" // checks to see if the given domain name is valid }, }, messages: { email: { email: "email address is invalid", required: "your email address.", remote: jQuery.format("the domain does not exist or is misspelled.") } } }); }); </script> html form <form name="check" action="#" method="post" id="test" style="margin- top:100px; margin-left:300px;"> <label for="email" id="test">uw e-mailadres</label> <input type="text" id="email" name="email" style="border:dotted 1px #000;" class="man" /> <input type="submit" name="send" value="send" style="width:auto;" /> <input type="reset" value="cancel" style="width:auto;" /> </form> Now i like to see that the php variable $hostName is passed to remote:jQuery.format(). I believe that ajax is needed or validator.addMethod or both, but I have no idea how that is done. Any help is welcome and appreciated.