I have two JavaScript file which has some functions within a name space. But when i try to invoke this function from my main page it is throwing an error telling "Object # has no method 'LoadAllBooks'"... But I have invoked the the function by using namespace.function.
Here is the code in the JavaScript file Util.js
var myNameSpace = {
Book: function (author, title, URL) {
this.author = author;
this.title = title;
this.URL = URL;
},
LoadAllBooks: function (metadata, attachPoint) {
Some Code--
},
arr: [],
oneBook: {}
};
Now the above function LoadAllBooks is called from my html home page as shown below.
<script>
var attachpoint = document.querySelector('.buttonAttachPoint');
$(document).on('load',myNameSpace.LoadAllBooks("ajax/metadata.json",this.attachpoint));
</script>
Could some please tell me why this is giving out an error?