shailendra
shailendra

Reputation: 205

jquery how to include .js files

When I checking stackoverflow or flipkart.com website code by view source in browser, I saw like that

<script type="text/javascript">
    StackExchange.init({
        "locale": "en",
        "stackAuthUrl": "https://stackauth.com",
        "serverTime": 1391174565,
        "styleCode": true,
        "enableUserHovercards": true,
        "site": {
            "name": "Stack <br/>Overflow",
            "description": "Q&A for professional and enthusiast programmers",
            "isNoticesTabEnabled": true,
            "recaptchaPublicKey": "6LdchgIAAAAAAJwGpIzRQSOFaO0pU6s44Xt8aTwc",
            "recaptchaAudioLang": "en",
            "nonAsciiTags": true,
            "enableSocialMediaInSharePopup": true
        },
        "user": {
            "fkey": "64a9dd799b4d7de695f9ab92904f258d",
            "isAnonymous": true
        }
    });
    StackExchange.using.setCacheBreakers({
        "js/prettify-full.en.js": "e0bbd4760e83",
        "js/moderator.en.js": "f24049d774be",
        "js/full-anon.en.js": "9f2bf11519b2",
        "js/full.en.js": "9fbd88448c92",
        "js/wmd.en.js": "849f408083f3",
        "js/third-party/jquery.autocomplete.min.js": "e5f01e97f7c3",
        "js/third-party/jquery.autocomplete.min.en.js": "",
        "js/mobile.en.js": "f979992d139c",
        "js/help.en.js": "d3cc74d8a93a",
        "js/tageditor.en.js": "6d51a5f8d7f3",
        "js/tageditornew.en.js": "5761dfb80bd0",
        "js/inline-tag-editing.en.js": "f951bd09dc69",
        "js/revisions.en.js": "33fd38144303",
        "js/review.en.js": "44c8a0044283",
        "js/tagsuggestions.en.js": "e4e7b952fcc7",
        "js/post-validation.en.js": "c275fe37d674",
        "js/explore-qlist.en.js": "73825bd006fc",
        "js/events.en.js": "c3218f63807f"
    }); < br / > StackExchange.using("gps", function () { < br / > StackExchange.gps.init(true); < br / >
    }); < br / >
</script>


I want to develop my web application so I also include .js file like this pattern

please help

thanks

Upvotes: 2

Views: 106

Answers (1)

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

Actually these are based on custom JavaScript files. If you're going to create a website of your own, you can create a custom js plugin. Where you create some methods and execute them on your own usage!

You might see this example of jQuery source code:

$(document).ready(function () {
   // remaining methods in this!
})

Similar thing with this SE source code. They are initializing the code and then letting the user have a chance to play with some methods!

As far as StackExchange and Flipcart are concerned, they have a team of developers working together to create these plugins. Its a matter of time and team work to do this work!

So, it would be better for you to first learn how and when JavaScript is loaded rather then creating a plugin like this!

Good luck.

Upvotes: 1

Related Questions