bootstrapvalidator remote

已邀请:

A_small_cake

赞同来自:

根据官方给出的api
当表单属性验证通过后可通过remote属性来执行ajax请求到后台验证! 不知道为啥官方下载的DEMO都不行!
知道的大虾帮忙解答下,谢谢!
下面例子就是官方demo中的
<!DOCTYPE html>
<html>
<head>
<title>BootstrapValidator demo</title>
<link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
<script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<!-- form: -->
<section>
<div class="page-header">
<h1>Sign up</h1>
</div>
<div class="col-lg-8 col-lg-offset-2">
<form id="defaultForm" method="post" class="form-horizontal" action="target.php">
<div class="form-group">
<label class="col-lg-3 control-label">Username</label>
<div class="col-lg-5">
<input type="text" class="form-control" name="username" autocomplete="off" />
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</section>
<!-- :form -->
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#defaultForm').bootstrapValidator({
message: 'This value is not valid',
// live: 'disabled',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and can\'t be empty'
},
remote: {
type: 'POST',
url: 'remote.php',
message: 'The username is not available',
delay: 1000
}
}
}
}
});
});
</script>
</body>
</html>

A_small_cake

赞同来自:

问题已经解决!

A_small_cake

赞同来自:

每日送彩 重庆时时彩开奖预测平台,为广大时时彩彩民,提供免费的开奖预测数据,帮助彩民们实现自主购彩提高中彩几率.

童言无忌

赞同来自:

请问怎么解决的

要回复问题请先登录注册