Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # post请求
- $.ajax({
- url: "/login/do_login",
- type: "POST",
- data:{
- mobile:$("#mobile").val(),
- password: password
- },
- success:function(data){
- layer.closeAll();
- if(data.status == 0){
- layer.msg("成功");
- window.location.href="/goods/to_list";
- }else{
- layer.msg(data.msg);
- }
- },
- error:function(){
- layer.closeAll();
- }
- });
- # Get请求
- $.ajax({
- url:"/goods/to_detail/"+goodsId,
- type:"GET",
- success:function(data){
- if(data.status == 0){
- render(data.data);
- }else{
- layer.msg("客户端请求有误");
- }
- },
- error:function(){
- layer.msg("客户端请求有误");
- }
- });
- # 启动加载
- $(function(){
- getGoodsList();
- });
- # 设置属性
- $("#buyButton").attr("disabled", true);
- $("#verifyCodeImg").attr("src", "/miaosha/verifyCode?goodsId="+$("#goodsId").val());
- # 设置text值
- $("#miaoshaTip").html("秒杀倒计时:"+remainSeconds+"秒");
- $("#goodsId").val()
- $("#userTip").hide();
- $("#verifyCodeImg").show();
- #时间转换
- $("#startTime").text(new Date(goods.startDate).format("yyyy-MM-dd hh:mm:ss"));
- # 主动轮询
- setTimeout(function(){getMiaoshaResult(goodsId);}, 200);
- # JQuery验证插件
- <script type="text/javascript" th:src="@{/jquery-validation/jquery.validate.min.js}" src="../static/jquery-validation/jquery.validate.min.js"></script>
- <script type="text/javascript" th:src="@{/jquery-validation/localization/messages_zh.min.js}" src="../static/jquery-validation/localization/messages_zh.min.js"></script>
- <input type="text" id="mobile" class="user" name="mobile" placeholder="请输入手机号码" required="true" minlength="11" maxlength="11">
- function login(){
- $("#loginForm").validate({
- submitHandler:function(form){
- doLogin();
- }
- });
- }
Add Comment
Please, Sign In to add comment