samedi 9 juillet 2016

TypeOf issue with jquery code

I am having an issue with some code...

This is the code:

(function($) {
    $.fn.inc = function(url, transform, post, t) {
        return this.length && url ? this.each(function() {
            t = $(this);
            $.ajax({
                url: url,
                success: function(txt, jqXHR, textStatus) {
                    t.html($.isFunction(transform) ? transform(txt, url) : txt);
                    $.isFunction(post) && post(url, jqXHR, textStatus);
                }
            });
        }) : this;
    };

    $(function() {
    $('[class*="inc:"]').each(function() {
        var match = /inc:(S+)/.exec(this.className || '');
        if(typeOf(match[1]) != "undefined")
          match && $(this).inc(unescape(match[1]));
    });

  });

})(jQuery);

and on line 18 it's point to this error:

ReferenceError: typeOf is not defined


if(typeOf(match[1]) != "undefined")

What's wrong with the code?

Error pic: enter image description here

Aucun commentaire:

Enregistrer un commentaire