douqiao6563 2014-01-07 09:34
浏览 42

如何显示警报框?

The following code actually submits and with the same i need to display an alert box showing message has been sent.

Code :

<input type="button" class="Jdvs_Btn" onclick="send_reply('SEND_REPLY', <? echo $clsSurvey->feedback_id?>);" value="SEND" style="font-weight:bold;width:95px;height:30px;float:left; margin-right:5px;" />

And the Javascript

Code:

if(action == "SEND_REPLY")
{
if( frm.email.value == "" )
{
   alert("Please fill your email.");
   frm.email.focus();
   return false;
}   
else if( validateEmailAddress(frm.email.value) == false )
{
    alert("Please fill a valid email.");
    frm.email.focus();
    return;
}
else if ((tinymce.EditorManager.get('content_to_send').getContent()) == '')
{
    alert("Please enter content to send.");
    return;
}
else
{
    frm.form_action.value = action;
    frm.submit(); 
    alert('Message Sent Successfully');
}

}

The code for mailing is: This is where the validation and other are done, i need to display an alert box here Code:

function sendReply()
{
    echo $this->feedback_id;
    $this->checkAndUpdateReply($this->feedback_id,$this->content_to_send);
    $Message = nl2br($this->content_to_send);
    $mailMessage = "
    <html>
    <head>
    <title>constant('_SHORT_PRODUCT_NAME') - Feedback Mail</title>
    </head>
    <body>";
            $Message = nl2br($this->content_to_send);
        $mailMessage.= $Message."
    <table border='0' cellpadding='0' cellspacing='0'width='100%'>
    <tr>
    <td style='$css_class' align='left'><br/>Email: "._EMAIL_INFO."</td>
        </tr>
        <tr>
        <td style='$css_height' align='left'><br /><b>Note</b>:- This is an automatically generated email , Please dont reply back to this mail.</td>
    </tr>
        </table>
    </body>
    </html>";    
    $mailSubject= constant('_SHORT_PRODUCT_NAME').' - FeedBack Reply';
    $clsEmailTempalte = new clsEmailTemplate($connect, ""); 
    $clsEmailTempalte->sendMail($mailSubject,$mailMessage,$this->email);
}
  • 写回答

4条回答 默认 最新

  • duanjian5059 2014-01-07 09:36
    关注

    At the end of your send_reply javascript function just do an alert("Mail Sent");

    If you're using ajax (e.g. with jQuery) you'll need to add your alert to the callback.

    For jQuery:

    var jqxhr = $.ajax( "example.php" )
      .done(function() {
        alert( "success" );
      })
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?