[validate] remote php checker replies ...void. Anytime

[validate] remote php checker replies ...void. Anytime

Hi to all, i'm just-another-jQuery-Validate-plugin-user.
keywords: jQuery plugin validation, aja php email checker, bad reply.

A.php contain a subscribe-us-form, jQuery and validator plugin, both in latest version. Well, searchin for a really-well-formed email checker i try with remote validation, but my problem are before, in the ajax reply. I'm using firefox and firebug to check all.
A.php ask B.php to check email, and when i call B.php directly from browser i give a reply. When A call B thru ajax give only a 200 OK response and an empty reply. EverEmpty. I try with a simple "echo" on boolean, Echo on var_dump, apply json:_encode, putting header and leaving header. The B.php reply it's even the same: void. Other sample in web send me a reply 'true' or 'false', and probably Firebug put around it a minimal <head></head><body>true</body>.

I will see any php source for email remote checker, for the reply format.

Sample of files (i change them searchin any solution, so url are not published)

A.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    <head>
    (snip)
    <!-- javascript -->
    <!-- --><script type="text/javascript" src="./javascript/jquery-1.4.2.js"></script>
    <!-- --><script type="text/javascript" src="./javascript/jquery-ui-1.7.2.custom.min.js"></script>

    <!-- --><script type="text/javascript" src="./javascript/ui/ui.core.js"></script>
    <!-- --><script type="text/javascript" src="./javascript/ui/ui.datepicker.js"></script>
    <!-- --><script type="text/javascript" src="./javascript/ui/i18n/ui.datepicker-it.js"></script>
    <!-- --><script type="text/javascript" src="./javascript/jquery.validate.js"></script>
    <!-- --><script type="text/javascript" src="./javascript/jquery.validate.local/messages_it.js"></script>
    <!-- Load TinyMCE -->
    <script type="text/javascript" src="./javascript/tiny_mce/jquery.tinymce.js"></script>
    (snip)
        <hr />
        <div id='corpo-colonna2'><a name='contenuto'></a>
            <div id='fiaf-news-iscrizioni'>
        <h2>Newsletter FIAF - indirizzario</h2>
    <!-- / --><br />
            <form action='/fiaf-nl.php?op=mlg' method='post' id='managelist' name='managelist'>
                <fieldset>
                    <legend style='font-size: large;'>
                        IN &#38; OUT
                    </legend>

                    <ul class='integrazioni-1'>
                        <li>
                            <label class='label' for='entra'> ENTRA / si iscrive / IN : </label>
                            <br />
                            <input name='entra' id='entra' type='text' value='nuovo-indirizzo@dominio.local' size='80' maxsize='300' />
                        </li>
                        <li>
                            <label class='label' for='esce'> ESCE / si toglie / OUT : </label>
                            <br />

                            <input name='esce' id='esce' type='text' value='vecchio-indirizzo@dominio.local' size='80' maxsize='300'  />
                        </li>
                    </ul>
                </fieldset>
        </div>
        <div class='ui-state-default ui-corner-all pad5'>
            <br style='clear: both;' />
            <input type='submit' id='submit' value='Registra modifiche &raquo;' style='clear: both; margin: 0; width: 20em; float: left;' /> <input type='reset' id='reset' value='Reset' style='width: 20em; float: right; margin: 0;' />
            <br />

        </div>
        </form>
    (snip)
    </div>
    <script type="text/javascript" language="javascript">
    <!--
        $(document).ready(function(){
            $("#managelist").validate({
            debug: true,
            rules: {
                entra: {
                    minlength: 6,
                    remote: {
                        url: "http://lnx.___.it/aja/email-check.php",
                        data: {
                            email: function() {
                                return $("#entra").val();
                            }
                        }
                    } // remote
                }, // entra
                esce: {
                    minlength: 6,
                    remote: {
                        url: "http://lnx.__.it/aja/email-check.php",
                        data: {
                            email: function() {
                                return $("#esce").val();
                            }
                        }
                    } // remote
                }  // esce
            }, // rules
            messages: {
                entra: {
                    minlength: jQuery.format("una email &#232; lunga almeno {0} caratteri"),
                    remote: jQuery.format("questa non sembra una email valida")
                }, // entra
                esce: {
                    minlength: jQuery.format("una email &#232; lunga almeno {0} caratteri"),
                    remote: jQuery.format("questa non sembra una email valida")
                }  // esce
            }  // messages
           
            });
        });

    //-->
    </script><!-- / -->
    (snip)
    </body>
    </html>






































































































B.php
  1. <?php
    //    contributors:
    //    php.net/manual/en/function.getmxrr.php
    //    http://www.linuxjournal.com/article/9585
        $str_in  = (strlen($_GET['email']) > 0) ? urldecode($_GET['email']) : "";   

    function validEmail($email) {
    (snip)
       return $isValid;
    } // bool validEmail (string)

        $b_ok = false;
        if ($str_in <> "")
            $b_ok = validEmail( $str_in );

        header("Content-type: text/html; charset=iso-8859-1");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        echo json_encode($b_ok); // echo ($b_ok ? 'true' : 'false');
        exit;
    ?>