shorif2000
shorif2000

Reputation: 2654

toJSON not working

I have the following piece of code and would like to know how to make it work.

that.clear = function() {
        setCookie(cookieName, [].toJSON(), "/", document.domain, false,
                cookieLifeHours);
        that.renderPopup();
    };

I have tried including jquery.json.js?ver=2.5.1 but it has not made any difference.

Upvotes: 0

Views: 1551

Answers (1)

Amit Joki
Amit Joki

Reputation: 59232

Don't know what's toJSON, but you can use the native implementation - JSON.stringify

JSON.stringify([]) // "[]"

But, don't know what you're trying to do by encoding an empty array as JSON.

Upvotes: 2

Related Questions