I have wrote this function in a class:
Code:
this.loadCanvas = function(json) {
    // parse the data into the canvas
    stage.loadFromJSON(json);

    // re-render the canvas
    stage.renderAll();
}
Where stage is new fabric object.

But in the browser it is showing this error:
Code:
Uncaught TypeError: Cannot call method 'loadFromJSON' of undefined
Please tell how can I solve this?