Everything your browser loads with javascript isn't crawled by Google. It's like turning off javascript in your browser.
If you'r widget is embedded on the third party site using only javascript, Google won't see your HTML at all.
As for the two links: the first link will be crawled (if Google would see your HTML). The second link won't, use following instead:
<a href="www.mysite.com" onclick="send_link(this.href); return false;" >Click here</a>