Launch the function loadJSON() with a html button

What is the exact text of your error? Can you call myfunction from something other than an onclick callback? Can you visit the URL directly?