フォームを送信した後にテキストを変更したいと思います。 submit to friend 1
をクリックしてからInvited to Your friend
にテキストを変更しますが、変更しない場合はsubmit to friend 2
とします。 submit to friend 2
をクリックすると、submit to friend 2
のテキストが変更されます。私のフォームはここにあるajaxでsuccesの後にテキストを変更する方法
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".flip").click(function(){
$(this).next().find(".panel").slideToggle("slow");
});
});
function send_to_friend(){
$.ajax({
type:"post",
url:"mail.php",
data:dataString,
cache:false,
success: function(data){
$('.panel').slideUp("slow");
$('.flip').html("Invited to Your friend");
}
});
return false;
}
</script>
..あなたは、両方の<h>
要素に同じクラス識別子を使用している
<style>
.flip{
cursor:pointer;
font-family: "Open Sans", Arial, sans-serif;
color: #2ea3f2;
text-decoration:underline;
font-size: 14px;
}
.panel{
margin:5px 0;
padding:21px;
display:none;
background-color: #f6f6f6;
border: solid 1px #c3c3c3;
}
.submitfield_style{
width: 87px;
height: 29px;
border: 1px solid #ccc;
background: #fff;
color: #999;
cursor: pointer;
}
</style>
<h5 class="flip">Send to a friend 1<h5>
<div class="panel">
<form method="post" action="">
<input type="submit" name="submit" id="submit" class="submitfield_style" onClick="return send_to_friend()">
</form>
</div>
<h5 class="flip">Send to a friend 2<h5>
<div class="panel">
<form method="post" action="">
<input type="submit" name="submit" id="submit" class="submitfield_style" onClick="return send_to_friend()">
</form>
</div>
解決策を試しましたか、疑問があれば教えてください。 –
親愛なる私の仕事は、最初に「友人に送る」でフリップダウンし、メッセージを書いて電子メールアドレスを書いて、送信ボタンを押すと友人にメールを送り、「あなたの友人に招待」 (a)ページをリロードしない(b)ページに何個の「send to friend」があるかわからない(c)HTMLコードはそれを変更しない –