Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you add jquery in a html page as a web resource in dynamics crm 2011

having a lot of trouble with this one. I am trying to run a simple jquery script inside of an html page to just pop up an alert box.

I have uploaded the jquery library and the json library

I have an html page with the following references and the reference to my jquery script. It is not coming up with the alert however when I embed this html as an iframe.

 <SCRIPT src="../ClientGlobalContext.js.aspx"></SCRIPT>
 <SCRIPT type=text/javascript src="../jquery1.4.1.min.js"></SCRIPT>

I was reading something about relative paths and what have you I have tried

<SCRIPT type=text/javascript src="../Script/jquery1.4.1.min.js"></SCRIPT>

<SCRIPT type=text/javascript src="../Scripts/jquery1.4.1.min.js"></SCRIPT>

both.

But its not working.

like image 927
Calibre2010 Avatar asked Mar 08 '11 13:03

Calibre2010


People also ask

How can we add the jQuery library to your web pages?

In order to make use of all the exciting features jQuery has to offer, we have to add the jQuery library to our webpages. Like any other JavaScript library, jQuery is added to a webpage by placing the script tag inside the head tag with the src of the script tag pointing towards the jQuery library, as shown below.

What is jQuery add jQuery in web page?

Include the jQuery by CDNStep 1: Firstly, we have to open that Html file in which we want to add the jQuery using CDN. Step 2: After then, we have to place the cursor between the head tag just before the title tag. And, then we have to use the <script> tag, which specify the src attribute for adding.

How do I add JavaScript Web resources to Dynamics 365?

To add a web resource, select the tab (for example, General or Notes) you would like to insert it on, and then on the Insert tab, select Web Resource. To edit a Web resource, select a form tab and the web resource that you want to edit, and then on the Home tab, select Change Properties.


1 Answers

I see two options available to you.

Option 1: Relative Paths Web Resources can point to each other via relative paths. So, it really depends on the "Name" of your html web resource and your jquery web resources.

The "Name" of a web resource cannot be changed after it has been created. So, you want to pay close attention to this. (You can always delete it and create it again with a new name, though.) This Name value can have a path in it.

For example, your jQuery library web resource might have a Name of "/Scripts/jquery.js". If you html page (that your iframe points to) has a name of "/Pages/mypage.html", then that html page must reference the jQuery library like so:

<script src="../Scripts/jquery.js"></script>

It has to go up a level to get out of the Pages folder, then down into the Scripts folder, and hits the jquery.js file. You can think of this as a real file system, as if you were working with a regular ASP.NET site.

Option 2: CDN Google (and other networks) host libraries like jQuery on their Content Delivery Networks (CDN). They designed these to be extremely fast and reliable. If you don't mind requiring a connection to the internet for your functionality to work, you can link directly to jquery on Google's CDN.

To do this, change your script tag for jQuery to this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
like image 86
EndangeredMassa Avatar answered Sep 22 '22 15:09

EndangeredMassa