// When button is clicked execute this function:
$("#thebutton").click ( function(){
// put lines of code in here
} );
// After asynchronous Ajax file read finishes, at some time in future, call this function:
var loader = new THREE.TextureLoader();
loader.load ( filename, function ( texture ) {
....
} );