(function($j) {
    $j.fn.poll = function(options){
        var $jthis = $j(this);
        // extend our default options with those provided
        var opts = $j.extend({}, $j.fn.poll.defaults, options);
        $j.fn.poll.intervalId = setInterval(update, opts.interval);
        // method used to update element html
        function update(){
            $j.ajax({
                type: opts.type,
                url: opts.url,
                success: opts.success
            });
        };
    };
    // default options
    $j.fn.poll.defaults = {
        type: "POST",
        url: ".",
        success: '',
        interval: 2000
    };
})(jQuery);

