jquery警报插件,jConfirm
当我不使用 jquery 的警报插件时,我得到了这个脚本,它可以完美地工作。但我需要使用警报插件,在学习了教程后我实现了它。但该脚本似乎不起作用。
<script type = "text/javascript">
$(document).ready(function() {
var pos = $("tr.verify").attr('id');
var frmId = $('#'+ pos).find("form").attr('id');
$('#'+ frmId).click(function(event) {
jConfirm('Are you sure you want to verify?', 'Confirmation Dialog',
function(r) {
if(r==true)
{
$.ajax({
type: "POST",
url: "verify.php",
data: $("form#" + frmId).serialize(),
success: function(msg){
if(msg.indexOf("success") > -1)
{
//success in registaration
var inputsub = $("form#" + frmId).find('input[type=submit]').attr('id');
$('#' + inputsub).val('verified').attr('disabled','disabled');
} //end of if
else if(msg.indexOf("Error") > -1)
{
alert(msg);
} //end of else if
} // end of success event
}); //end of ajax code
} // end of if r == true
return false;
}); //the alert code
}); //end of form submit
}); //Main document ready code
</script>
I got this script which works perfect when i am not using jquery's alert plugin. But i need to use alert plugin and after learning from a tutorial i implemented it. But the script does not seem to work.
<script type = "text/javascript">
$(document).ready(function() {
var pos = $("tr.verify").attr('id');
var frmId = $('#'+ pos).find("form").attr('id');
$('#'+ frmId).click(function(event) {
jConfirm('Are you sure you want to verify?', 'Confirmation Dialog',
function(r) {
if(r==true)
{
$.ajax({
type: "POST",
url: "verify.php",
data: $("form#" + frmId).serialize(),
success: function(msg){
if(msg.indexOf("success") > -1)
{
//success in registaration
var inputsub = $("form#" + frmId).find('input[type=submit]').attr('id');
$('#' + inputsub).val('verified').attr('disabled','disabled');
} //end of if
else if(msg.indexOf("Error") > -1)
{
alert(msg);
} //end of else if
} // end of success event
}); //end of ajax code
} // end of if r == true
return false;
}); //the alert code
}); //end of form submit
}); //Main document ready code
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢扎卡尔韦的回复。我弄清楚出了什么问题。阅读文档后,我发现我使用的是旧版本的 jQuery 即 1.2.2,而插件需要 1.2.6 或更高版本。这是一个愚蠢的错误,导致我浪费了 3 个小时。无论如何值得注意..谢谢
Thanks zakalwe for your reply. I figured it out what was wrong.. Reading the documentation i found out that i was using the older version of jQuery viz 1.2.2 and the plugin required 1.2.6 or later. This was a silly mistake which cost me 3 hrs. Anyways worth taking note of..thanks