Hi Ali,
That's not correct selector to get canvas element.
You should use here correct one.
You can find details on the screen shot: http://prntscr.com/6rtz1w/direct
Also you can try this code instead of your if your canvas id is "signature_pad":
pre
var canvas = jQuery("#signature_pad")[0];
/pre
Regards