美文网首页
搜索数据刷新页面(超级蠢的需求)

搜索数据刷新页面(超级蠢的需求)

作者: 泉落云生 | 来源:发表于2018-04-18 20:55 被阅读1次
var _href = "{{ config('app.source_url') }}merchants/shareEvent/list";

function searchName(that){
    var thisurl = window.location.href;
    var inval = $(that).val();
   if(thisurl.match(/(type=0)/g)){
     window.location.href=_href+'?type=0&product_name='+inval
     }else if(thisurl.match(/(type=1)/g)){
        window.location.href=_href+'?type=1&product_name='+inval
    }else{
         window.location.href=_href+'?product_name='+inval
}
//下面不合理,会跳转页面,因为有三种状态,都会返回''
    $.ajax({
        type:'get',
        url:_href,
        dataType:"html",
        contentType:'application/json; charset=utf-8',
        data:{
            product_name:$('#searchInput').val(),
        },
        success:function(res){
            $("body").html(res);
        }
    })
}

相关文章

网友评论

      本文标题:搜索数据刷新页面(超级蠢的需求)

      本文链接:https://www.haomeiwen.com/subject/rlvbkftx.html