Last active
December 10, 2015 06:28
-
-
Save EihabShadeed/4394194 to your computer and use it in GitHub Desktop.
JavaScript: Self-Invoker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;( function(FunctionName, $, undefined) { | |
var $body = $('body'), $html = $('html'), $doc = $(document); | |
var ajax_fill = function(ajax_url, id_name) | |
{ | |
$.ajax({ | |
type: "GET", | |
dataType: "html", | |
url: ajax_url, | |
success: function(t) { | |
if ( t && t.length > 10 ) { | |
var e = $(id_name); | |
e.html(t); | |
e.css({"display": "block"}); | |
} | |
} | |
}); | |
}; | |
var image_auto_req = function( q ) { | |
var ajax_url = "/a/imageauto?q=" + encodeURIComponent( q ); | |
ajax_fill(ajax_url, "#image_auto_div"); | |
}; | |
$doc.ready(function() { | |
// Do Something | |
}); | |
}(window.FunctionName = window.FunctionName || {}, jQuery)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment