誰もが、私はremote
関数が失敗したときjQuery ValidatorがerrorPlacement
ハンドラを呼び出すために得ることができる方法を教えていただけますか?私は簡単な例を提供していますjQuery ValidatorをリモートでerrorPlacementをトリガーする方法は?
クリフ注:その文書によると、私は出力JSONにありますが、私はちょうどjson_encodeをエコーか、または私のようにecho json_encode(array('result' => 0))
のようなキーを提供しないので、私は何かを見逃している必要がありますこれで言うのはblock of textです。
JS:
var validator = $("form#signup").validate({
onfocousout: true,
rules: {
email: {
required: true,
email: true,
remote: {
type: "POST",
url: 'test.php',
data: {
email: function() {return $("#email").val();}
}
}
},
errorPlacement: function(error, el) {
console.log('ERR' + $(el).attr('id'));
}
}
});
PHP:私は「
<?php
echo 'false';
:私はあなたのPHPスクリプトから文字列としてfalse
をエコーする必要があると思う
<?php
echo false; // This should allow the errorPlacement to call shouldn't it?
'json_encode(FALSE)'をエコーしたい場合があります。 (しかし、ソースを正しく理解していれば、エラーは発生しません。) – Zombaya