To answer your official question, yes, I believe that this can be achieved.
But in order to dwell on this in more detail, I believe that you can try to work, this is the order in which your external scripts and external markup are loaded. An interesting situation that we find when working with asynchronous actions, such as these, is that they do not always populate, load, or execute in the order you want, unless you specifically talk about it. jQuery allows you to do this through some callbacks that you can pass to the getScript and load methods.
There should also be no problem with cross domains with javascript files on other domains, although, of course, there is HTML when loading.
I'm not sure if this will exactly solve the problem you are facing, but it seems like it is worth a try. You can try to make sure that the markup is loaded before the scripts are executed:
$(function(){ $("#socialmedia").live('click',function(){ $("#loadhere").load('html-part.html', function() {
Now we also need to ask how you create the js-part.js file. (You only showed what you wanted, not what you created.) If this is really a JS file, you cannot just use HTML <script> tags to load other JS files. (Instead, you will want to continue the getScript call in this file or use one of several other methods to load other loaded JS files, for example, manually adding script elements to the document head or using another library, etc ...)
Good luck
source share