开发者

What is the error in this jQuery code?

I have the below jQuery code, but it does not work at all.

Firebug says there is a ) missing, but where?

开发者_如何学运维
$.get(url: 'example.html', function(data) {
        var $page = $(data);
        $page.filter('script').add($page.find('script')).each(function(){
            $.globalEval(this.text || this.textContent || this.innerHTML || '');
        });
        $('#form').html(data);
    }
});


$.get(url: 'example.html',...

should be

$.get('example.html',...

and you have one } too much at the end.


$.get('example.html', function(data) {
        var $page = $(data);
        $page.filter('script').add($page.find('script')).each(function(){
            $.globalEval(this.text || this.textContent || this.innerHTML || '');
        });
        $('#form').html(data);
    } // <---- this thing is not needed
});


You had a extra } and url: 'example.html' that part should not contain url:

$.get(/*url: This part is removed*/'example.html', function(data) {
    var $page = $(data);
    $page.filter('script').add($page.find('script')).each(function(){
        $.globalEval(this.text || this.textContent || this.innerHTML || '');
    });
    $('#form').html(data);
    //} This one has also been removed
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜