MS CRM 2013 adds version number to WebResources script type

I found a strange problem in MS CRM 2013, and since it seems to be in design, I need help to find a way around it.

The problem is the inability to call the getScript jQuery method from WebResource.

CRM adds the version string to the URL, and this causes the request to fail with a 500 error.

For example, when I try to call: /Organization/WebResources/Synchronization.js

CRM reverses this request to the following: /Organization/WebResources/Synchronization.js?_=1402918931398 and it fails with a 500 server error.

Here is an example of the code I'm using:

 var settings = { url: "/Organization/WebResources/Synchronization.js", dataType: "script", success: function (data) { console.log("success"); }, error: function(jqXHR, textStatus, errorThrown) { console.log("error"); } }; $.ajax(settings); 

Could you please tell me how I can find out when the URL changes?

+6
source share
1 answer

It looks like this is a jQuery caching function.

If caching is enabled in the settings object, the problem will disappear. Like this:

 var settings = { url: "/Organization/WebResources/Synchronization.js", cache: true, dataType: "script", success: function (data) { console.log("success"); }, error: function(jqXHR, textStatus, errorThrown) { console.log("error"); } }; 
+4
source

Source: https://habr.com/ru/post/970894/


All Articles