Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 663 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to include jQuery in ASP.Net project?

#1
I've read that Microsoft now [bundles jQuery with Visual Studio][1]. How then do I "include" the jQuery source in my ASP.Net project?


[1]:

[To see links please register here]

Reply

#2
You might be looking for this [Microsoft Ajax Content Delivery Network][1]
So you could just add

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>

To your aspx page.

[1]:

[To see links please register here]

Reply

#3
You can include the script file directly in your page/master page, etc using:

<script type="text/javascript" src="/scripts/jquery.min.js"></script>

Us use a Content Delivery network like Google or Microsoft:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

or:

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script>
Reply

#4
if you build an MVC project, its included by default. otherwise, what Nick said.
Reply

#5
There are actually a few ways this can be done:

**1: Download**

You can [download the latest version of jQuery][1] and then include it in your page with a standard HTML script tag. This can be done within the master or an individual page.

HTML5

<script src="/scripts/jquery-2.1.0.min.js"></script>

HTML4

<script src="/scripts/jquery-2.1.0.min.js" type="text/javascript"></script>

----------
**2: Content Delivery Network**

You can include jQuery to your site using a [CDN][2] (Content Delivery Network) such as Google's. This should help reduce page load times if the user has already visited a site using the same version from the same CDN.

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>

----------

**3: NuGet Package Manager**

Lastly, (my preferred) use [NuGet][3] which is shipped with Visual Studio and Visual Studio Express. This is accessed from right-clicking on your project and clicking *Manage NuGet Packages*.

> NuGet is an open source Library Package Manager that comes as a Visual
> Studio extension and that makes it very easy to add, remove, and
> update external libraries in your Visual Studio projects and websites.
*Beginning ASP.NET 4.5 in C# and VB.NET, WROX, 2013*

![enter image description here][4]

Once installed, a new Folder group will appear in your Solution Explorer called `Scripts`. Simply drag and drop the file you wish to include onto your page of choice.

This method is ideal for larger projects because if you choose to remove the files, or change versions later (though the package manager) if will automatically remove/update any reference to that file within your project.

The only downside to this approach is it does not use a CDN to host the file so page load time may be slightly slower the first time the user visits your site.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

[4]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through