// 解析定位结果
 function onComplete(data) {
     var userLocationLat;
     var userLocationLon;
     var locationNaCode = getCookie('LocationNavigatorCode');
     if (data.coords) {
         userLocationLat = data.coords.latitude;
         userLocationLon = data.coords.longitude;
     } else {
         userLocationLat = data.position.getLat();
         userLocationLon = data.position.getLng();
     }
     if (locationNaCode === undefined && locationNaCode === null) {
         // 储存经纬度cookie
         var date = new Date();
         date.setDate(date.getDate() + 3);
         var strcookie = 'LocationNavigatorCode=' + userLocationLat + '';
         strcookie += ',' + userLocationLon + ';path=/;expires=' + date.toGMTString() + '';
         document.cookie = strcookie;
     }
     // 获取城市name
     var code = $('#userinfor').attr('data-citycode');
     $.get('https://mip.zhaopin.com/Home/GetCityInfoByLatLng',
     {lat: userLocationLat, lng: userLocationLon},
     function (data, textStatus, jqxhr) {
         if ($('.j_searchTop .position span').text() === '全国') {
             $('.j_searchTop .position span').text(data.cityname);
         }
     });
 }
        zan: function () {
            if ($(this).hasClass('done')) {
                return false;
            }
            $(this).addClass('done');
            var id = $(this).data('id');
            var classid = $(this).data('classid');
            var rateHolder = $(this).children('.count');
            var ajaxData = {
                classid: classid,
                id: id,
                dotop: 1,
                doajax: 1,
                ajaxarea: 'diggnum'
            };
            $.get('/e/public/digg/index.php', ajaxData,
                function (data) {
                    var dingnumr = data.substring(0, data.indexOf('|'));
                    if (!dingnumr) {
                        $(rateHolder).html(dingnumr);
                    }
                    else {
                        alert('你已经提交过了');
                    }

                });
            return false;
        },
Пример #3
0
navigator.geolocation.getCurrentPosition(function(position){
  var latlng = [position.coords.latitude,position.coords.longitude].join(",");
  $.get("/api/v1/location/latlng/" + latlng, function(data){
    var result = data.result;
    $("#latlng").val(result.location.lat + "," + result.location.lng);
    $(".location .input").val(result.pois[0].name);
  });
},function(){
Пример #4
0
    $("#j_fav_shop").on('click', function () {
        var btn = $(this);
        var shopId = btn.data('shopid');
        var icon = btn.find('.iconfont');
        var isFaved = icon.hasClass('fav-active');

        icon.toggleClass('fav-active', !isFaved);

        $.get((isFaved ? SHOP_REMOVE_FAV_API : SHOP_ADD_FAV_API) + shopId);
        return false;
    });
 $(element).parent().parent().find('#more-btn').on('click', function () {
     pageNum = pageNum + 1;
     $.get('https://mip.linkeddb.com/music/letter/' + letter + '/p' + pageNum + '/',
         function (html) {
             if (html) {
                 $(html).appendTo($(element).parent().parent().find('.itemsCont'));
             } else {
                 $(element).parent().parent().find('#more-btn').hide();
             }
         });
 });
Пример #6
0
    $("#j_fav_goods").on('click', function () {
        var btn = $(this);
        var sku = btn.data('sku');
        var isFaved = btn.hasClass('fav-active');

        isFaved ? btn.html(" 收藏") : btn.html(" 取消收藏");
        
        btn.toggleClass('fav-active', !isFaved);

        $.get((isFaved ? GOODS_REMOVE_FAV_API : GOODS_ADD_FAV_API) + sku);
        return false;
    });
        function initBrand(eqId, from) {
            $.get(getBrandUrl + '/' + eqId, [], function (data) {
                var obj = $.parseJSON(data);
                var list = obj.data.brand_list;
                var groupStr = '';
                var charStr = '';
                var str = '';
                var strStart = '<div class="left">\
                                    <div class="group">\
                                        <ul class="groupUl">\
                                        <li rel="brand" brand="" \
                                        brandId="0" data-txt="品牌">全部品牌</li>\
                                        </ul>\
                                    </div>';
                var strEnd = '</div>';
                var i;
                for (i in list) {

                    var itemStr = '';
                    var j;
                    for (j in list[i]) {
                        itemStr += '<li rel="brand" brand="'
                        + list[i][j].identifier + '" brandId="'
                        + list[i][j].id + '" ><em>'
                        + list[i][j].name + '</em><i class="arrowR"></i></li>';
                    }

                    charStr += '<li data-alpha="A">' + i + '</li>';
                    groupStr += '<div class="group" class="' + i + '">\
                                    <p class="alpha">' + i + '</p>\
                                    <ul class="groupUl">\
                                    ' + itemStr + '\
                                    </ul>\
                                 </div>';
                }

                charStr = '<ol class="navAlpha">' + charStr + '</ol>';
                str = strStart + groupStr + strEnd
                    + '<div id="modelList" class="right"></div>' + charStr;

                $('#brandList').html(str);

                if (from === 'fromSelect') {
                    currentBrand = '';
                    currentBrandid = '0';
                    $('#brandCon').removeClass('selected');
                    $('#brandText').text('品牌');
                }
            });
        }
 function initCity(proId) {
     $.get(getCityUrl + '/' + proId, [], function (data) {
         var obj = $.parseJSON(data);
         var list = obj.data.city_list;
         var str = '';
         var i;
         for (i in list) {
             str += '<li rel="city" cityId="'
             + list[i].id + '" ><em>' + list[i].name + '</em></li>';
         }
         str = '<li rel="city" cityId="0" class="cur"\
         data-txt="不限"><em>不限</em></li>' + str;
         $('#cityList').html(str);
     });
 }
Пример #9
0
        loadHtml: function (url) {
            var that=this;

            url=url||that.route.url;

            if(records[url]) that.$el.html(records[url]);

            that.$el.loading('show');

            $.get(url+(/\?/.test(url)?"&":"?")+"request=ajax",function (res) {
                records[url]=res;
                that.$el.loading('hide').html(res);

                console.log("loadHtmlEnd");

                that._initDfd.resolve();
            });
        }
Пример #10
0
 var loadTemplate = function(index){
     var name = names[index];
     if(self.templates[name] === undefined){
         $.get('./static/src/javascripts/tpls/'+name+'.html',function(data){
             self.templates[name] = data;
             if(++index < tplLength){
                 loadTemplate(index);
             }else{
                 cbf();
             }
         });
     }else{
         if(++index < tplLength){
             loadTemplate(index);
         }else{
             cbf();
         }            
     }
 };
        function initModel(eqId, brandId) {
            $.get(getModelUrl + '/'
                + eqId + '/' + brandId, [], function (data) {
                    var obj = $.parseJSON(data);
                    var list = obj.data;

                    var str = '';
                    var i;
                    for (i in list) {
                        str += '<li rel="model" modelId="'
                        + list[i].id + '" ><em>' + list[i].name + '</em></li>';
                    }

                    str = '<ul rel="model" modelId="0" class="hideUl">\
                    <li rel="model" modelId="0" ><em>不限</em></li>'
                    + str + '</ul>';

                    $('#modelList').html(str);
                });
        }
        $(this.element).parent().infinite().on('infinite', function () {
            // 如果正在加载,则退出
            if (loading) {
                return;
            }
            // 设置flag
            loading = true;
            if (pageType === 'person') {
                getUrl = 'https://mip.linkeddb.com/person/?page=' + pageNum;
            } else if (pageType === 'tv' || pageType === 'movie') {
                getUrl = 'https://mip.linkeddb.com/' + pageType + '/?page=' + pageNum;
            } else {
                getUrl = 'https://mip.linkeddb.com/movies/?page=' + pageNum;
            }
            $.get(getUrl, function (html) {
                if (html) {
                    // 重置加载flag
                    loading = false;
                    // 添加新条目
                    $(that.element).find('.infinite-list').append(html);
                    pageNum++;
                    // 容器发生改变,如果是js滚动,需要刷新滚动
                    // $.refreshScroller();
                } else {
                    // 加载完毕,则注销无限加载事件,以防不必要的加载
                    $(that.element).parent().destroyInfinite();
                    // 删除加载提示符
                    $(that.element).find('.weui-loadmore').remove();

                    $(that.element).find('.no-more').removeClass('hide');
                    setTimeout(function () {
                        $(that.element).find('.no-more').addClass('hide');
                    }, 1500);
                    return false;
                }
            });
        });
Пример #13
0
 initCount: function () {
     var self = this;
     $.get("/count/" + this.config.id, function (response) {
         self.setCount(response.count);
     });
 },
Пример #14
0
 //清除历史记录
 function clearHistory(){
     $.get(setting.clearHistory + "&callback=?");
 }