How do I send parameters to self invoking functions. like following code.
MyNameSpace.Administration.WebAdministrator = function () {
var init = function () {
//some code here
},
CreateSubSite = function (id, url) {
//some code here
}
return {
start: function () {
init();
},
createSubSite: CreateSubSite(myId, myUrl)
}();
$(document).ready(function () {
MyNameSpace.Administration.WebAdministrator.start();
$("div.large-app").on("click", "#btnCreate", function () {
var id = "something";
var url = "something";
MyNameSpace.Administration.WebAdministrator.createSubSite(id, url);
});
});
When I add this code on my js file and run the web application it says myId and myUrl not defind and not runing the js code.
Looks like you're really trying to do this
FIDDLE