搜索结果未显示

I am facing a problem with showing results on my dynamic search form. The code for jquery is:

     $("#searchterm").keyup(function (e) {
    if (this.value.length > 4) {
        var q = $("#searchterm").val();
        $('#output').text('You typed ' + $(this).val() + '.');
        $.getJSON('http://catalog.api.2gis.ru/search?what=' + q + '&where=москва&version=1.3&key=rujrdp3400&pagesize=50&callback=?',
        function (data) {
            var tmp = {};
            if (data !== undefined && data.result.length !== 0) {
                $.each(json.result,function(i,result) {
                    var type = result.id;
                    if (!tmp[type]) {
                        tmp[type] = [];
                    }
                    tmp[type].push(result);
                    alert(result.id);

                });
                var html = [];
                $.each(tmp, function (key, item) {
                    html.push('<div id=' + key + '><h3 id=' + key + '>' + key + '</h3> <span>');
                    html.push(result.length + '</span><ul id="items">');
                    $.each(result, function (i, val) {

   var isLiked = getItemIdxByIdFromStorage(val.id) != -1;
                        html.push('<li><a href="#" onClick="podcat('+"'"+val.id+"'"+')">'+val.name+'</a></li>');

                    });

                    html.push('</ul></div>');
                });

                $('#results').html(html.join(''));

                $('h3#listings').replaceWith('<h3>Total results: </h3>');

            } else {
                $('#results').html('Nothing found');
            }
        });
    } else {
        $('#results').html('Please type at least 5 characters');
    }
});

I am trying to get result.id and result.name...Please type pizza in the search field.

If anyone can help me please I would really appreciate it. Sorry but my jquery level is low than a beginner.

Also please use my fiddle http://jsfiddle.net/TCYyH/

You're requesting a JSONP response from the Web server (as indicated by the &callback=? parameter in the URL), instead of a more traditional JSON response. You should be able to debug your code from here.

Change your request from:

$.getJSON('http://catalog.api.2gis.ru/search?what=' + q + '&where=москва&version=1.3&key=rujrdp3400&pagesize=50&callback=?',

To this:

$.getJSON('http://catalog.api.2gis.ru/search?what=' + q + '&where=москва&version=1.3&key=rujrdp3400&pagesize=50',

To receive a JSON response instead.