How to use the zepto.parseJSON function in zepto

To help you get started, we’ve selected a few zepto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mipengine / mip-extensions / mip-iask-ajax / mip-iask-ajax.js View on Github external
var checkLogin = function (url, params, isLogin, div, type) {
        var json = $.parseJSON(params);
        if (isLogin) {
            // 验证是否登录
            var checkLoginUrl = 'http://m.iask.sina.com.cn/checkLogin?m=' + Math.random();
            $.get(checkLoginUrl,
            function (e) {
                if (e === null || e === 'null') {
                    // 跳转到登录页面
                    var thisHref = window.location.href;
                    window.location.href = 'http://m.iask.sina.com.cn/login?source=' + thisHref;
                }
                else {
                    ajaxPost(url, json, div, type);
                }
            });
        }
        else {
github mipengine / mip-extensions-platform / mip-fh-ad-plus / mip-fh-ad-plus.js View on Github external
$.getJSON(adUrl, query, function (res) {
            var isHasFhAd;
            var data = $.parseJSON(res.result);

            // 遍历直投广告ID
            $.each(data, function (k, v) {

                // 获取投放直销广告的节点
                element = $('mip-fh-ad-plus[fh-ad-pid="' + k + '"]');
                uid = element.attr('fh-ad-uid');

                // 根据医生id判断物料类型
                v = (query.uid && $.isPlainObject(v)) ? v[uid] : v;

                // 有特定广告位id的直投广告 先隐藏网盟 再显示直投
                if ($.trim(v)) {
                    element.children(':first-child').remove();
                    element.html(v);
github mipengine / mip / extensions / mip-fh-ad / 1.2 / mip-fh-ad.js View on Github external
$.getJSON(ajaxurl, query, function (json) {
                var adObj = $.parseJSON(json.result);

                // 遍历直投广告ID
                $.each(adObj, function (k, v) {
                    // 有特定广告位id的直投广告
                    if ($.trim(v)) {
                        // 根据广告id,判断广告的显示位置
                        switch (+k) {
                            // 底部悬浮广告
                            case 1:
                                element.html('<div id="ad_position_1">' + v + '</div>');
                                break;
                            case 14:
                                $('#liveAdBlock').html(v);
                                break;
                            // 我要提问广告位
                            case 47:
github mipengine / mip-extensions / mip-iask-ajax / mip-iask-ajax.js View on Github external
function (data) {
            var res = $.parseJSON(data);
            if (type === '1') {
                if (res.succ === 'Y' && res.jsonData === '1') {
                    var txt = $(div);
                    txt.text(parseInt(txt.text(), 0) + 1);
                }
            }
        });
    };
github mipengine / mip-extensions-platform / mip-trilobite-scroll / mip-trilobite-scroll.js View on Github external
+ '        <div class="content">'
                                                + value.title
                                                + '        </div>'
                                                + '        <div class="eye">'
                                                + '            <span class="time">'
                                                + value.created_at
                                                + '            </span>'
                                                + '        </div>'
                                                + '    '
                                                + '';
                                        }
                                        else {
                                            var imgnum = 0;
                                            var dom = '';
                                            var img = '';
                                            value.thumbnail = $.parseJSON(value.thumbnail);
                                            if ($.isArray(value.thumbnail)) {
                                                imgnum = value.thumbnail.length;
                                            }

                                            switch (imgnum) {
                                                case 0:
                                                    dom = '<a class="article-link" href="http://' + host + '/dc-admin/article/'
                                                        + siteid + '/'
                                                        + value.id
                                                        + '">'
                                                        + '    <div class="no-pic">'
                                                        + '        <div class="content">'
                                                        + value.title
                                                        + '        </div>'
                                                        + '        <div class="eye">'
                                                        + '            <span class="time">'</span></div></div></a>
github mipengine / mip-extensions-platform / mip-iask-business / mip-iask-business.js View on Github external
$.get(url, function (data) {
            var base = new Base64();
            var res = $.parseJSON(data);
            if (res.succ === 'Y') {
                var json = $.parseJSON(base.decode(res.html));
                var basedata = json.adList;
                var baiduStr = {type: 'click', data: ['_trackEvent', 'MIP_SY_103', 'skip', 'MIP_SY_103_ywk']};
                var baiduObj = 'data-stats-baidu-obj="' + encodeURIStr(baiduStr) + '"';
                for (var key in basedata) {
                    var obj = basedata[key];
                    if (obj.type === '1' && obj.materialType === '5') {
                        var nodeClass = isExistsNode();
                        $(nodeClass).append(centralBanner(obj.picLink, obj.picUrl, baiduObj, ''));
                        advLogInfoClick(ele, nodeClass + ' .href_log', ele.querySelector('.paramDiv'));
                    }
                    else if (obj.type === '3') {
                        var website = json.website;
                        var companyName = obj.companyName;
                        var drName   = obj.descb;
                        putQiyeInfo(ele, companyName, drName, website, obj.picUrl, baiduObj, '');
                    }
github mipengine / mip-extensions / src / mip-ck-course-detail / js / tpl-data.js View on Github external
$('script.tpl-json-data').each(function (i, script) {
        var $s = $(script);
        var dataStr = $s.text();
        var dataKey = $s.attr('data-key');

        var data;

        try {
            data = $.parseJSON(dataStr);
        }
        catch (ex) {
            data = {};
        }

        if (fixFnMap[dataKey]) {
            data = fixFnMap[dataKey](data);
        }

        tplData[dataKey] = data;
    });
github mipengine / mip-extensions / src / mip-iask-ext / mip-iask-ext.js View on Github external
function (data) {
                                var res = $.parseJSON(data);
                                alert(res.desc);
                            });
                            effects.clearReport();
github mipengine / mip-extensions-platform / mip-iask-business / mip-iask-business.js View on Github external
$.get(url, function (data) {
            var base = new Base64();
            var res = $.parseJSON(data);
            if (res.succ === 'Y') {
                var json = $.parseJSON(base.decode(res.html));
                var basedata = json.adList;
                var baiduStr = {type: 'click', data: ['_trackEvent', 'MIP_SY_103', 'skip', 'MIP_SY_103_ywk']};
                var baiduObj = 'data-stats-baidu-obj="' + encodeURIStr(baiduStr) + '"';
                for (var key in basedata) {
                    var obj = basedata[key];
                    if (obj.type === '1' && obj.materialType === '5') {
                        var nodeClass = isExistsNode();
                        $(nodeClass).append(centralBanner(obj.picLink, obj.picUrl, baiduObj, ''));
                        advLogInfoClick(ele, nodeClass + ' .href_log', ele.querySelector('.paramDiv'));
                    }
                    else if (obj.type === '3') {
                        var website = json.website;
                        var companyName = obj.companyName;
                        var drName   = obj.descb;
github mipengine / mip-extensions-platform / mip-iask-business / mip-iask-business.js View on Github external
function (data) {
            var base = new Base64();
            var res = $.parseJSON(data);
            if (res.succ === 'Y') {
                var json = $.parseJSON(base.decode(res.html));
                if (type === 'YL') {
                    youLai(ele, json);
                    return;
                }
                if (type === 'TZ') {
                    soulew(ele, json, 300);
                    return;
                }
                if (type === 'PPYL') {
                    brandMedical(ele, json);
                    return;
                }
                if (type === 'SLW') {
                    soulew(ele, json, 101);
                    return;
                };

zepto

Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you use jQuery, you already know how to use Zepto.

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis