jqueryでの経験はほとんどありません。私の質問はこれです。私はユーザー名とパスワードのフォームを持っています。私はPHPページにアクセスするJqueryを持っているデータベースにパスワードとユーザー名が一致したら "はい"またはいいえに基づいて、入力が正しい場合は、次のページに私を連れて行きます。今、このJQueryが提出して以来、私は単語を確認しないので、ページにjavascriptのcaptchaを正しく追加する方法を見つけることができません。だから、このコードを変更したり追加して、最初にjavascriptを使って単語を検証し、次にjqueryを使う方法があるのだろうかと思っています。どんな助けでも感謝します。JqueryとCaptchaは同じページでは機能しません。
<script language="javascript">
$(document).ready(function()
{
$("#login_form").submit(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
//check the username exists or not from ajax
$.post("ajax_login.php",{ user_name:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
{
if(data=='yes') //if correct login detail
{
$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
function()
{
//redirect to secure page
document.location='edujob.php';
});
});
}
else
{
$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('incorrect').addClass('messageboxerror').fadeTo(900,1);
});
}
});
return false; //not to post the form physically
});
//now call the ajax also focus move from
});
</script>
オフトピック:スクリプトの 'language'属性は推奨されていません。 'type =" text/javascript "を使うべきです、HTML5 doctypeを使っている場合は、単純な' 'タグを使うだけです。 –