zoukankan      html  css  js  c++  java
  • 关于ajax的提交未完再续!

                $.ajax({
                    cache: true,
                    type: "POST",
                    url:"__URL__/add",
                    data:$('#myform').serialize(),// 你的formid
                    async: false,
                    error: function(request) {
                        tichu('添加失败!','puti');
                        location.href="__URL__/add";
                    },
                    success: function(request) {
                        tichu('添加成功!','puti');
                        location.href="__URL__/add";
                    }
                });

    上面的提交方式可以将form表单id为myform的所有name值提交上去。

      if($rt){
        echo 1;exit;
      } else {
        echo 2;exit;
      }

    上面是我的返回

                                                        function u(id){
                                                            var sort = $('#p_sort').val();
    //                                                        layer.confirm('确认要更改排序吗?',function(index){
                                                              //alert('__APP__/Back/Product/Up_id/id/'+id+'/sort/'+sort);
    //                                                          return false;
                                                            $.get('__APP__/Back/Product/Up_id/id/'+id+'/sort/'+sort,function(mm){
                                                                if (mm==1) {
    //                                                                    $(obj).parents("tr").remove();
                                                                        layer.msg('设置成功!',{icon:1,time:1000});
                                                                        location.reload();
                                                                }else{
                                                                        layer.msg('设置失败!',{icon:1,time:1000});
                                                                        location.reload();
                                                                }
                                                             });
    //                                                                        });
    //                                                        location.reload();
                                                        }

    这种也是ajax返回格式

            $.ajax({
                cache: true,
                type: "GET",
                url: "{:U('Back/GoodsClassify/del')}",
                data: {id: id,two_id: two_id},
                async: false,
                error: function (request) {
    
                },
                success: function (request){
                    if(request==1){
                         $(obj).parents("tr").remove();
                         layer.msg('已删除!',{icon:1,time:1000}); 
                    }else if(request==2){
                         layer.msg('已删除!',{icon:1,time:1000});
                         location.reload(); 
                    }else{
                         layer.msg('删除失败!',{icon:1,time:1000});
                    }
                }
            });
    

      

  • 相关阅读:
    洛谷—— P3353 在你窗外闪耀的星星
    洛谷—— P1238 走迷宫
    洛谷—— P1262 间谍网络
    9.8——模拟赛
    洛谷—— P1189 SEARCH
    算法
    May 22nd 2017 Week 21st Monday
    May 21st 2017 Week 21st Sunday
    May 20th 2017 Week 20th Saturday
    May 19th 2017 Week 20th Friday
  • 原文地址:https://www.cnblogs.com/patf/p/5156421.html
Copyright © 2011-2022 走看看