I have found strange issue in MS CRM 2013, and since it seems to be by design, I need help to find a way around it.
The issue is it's impossible to call getScript
jQuery method from WebResource.
The CRM adds version string to the url, and this causes request fail with error 500
.
For example, when I'm trying to call: /Organization/WebResources/Synchronization.js
The CRM turns this request into following: /Organization/WebResources/Synchronization.js?_=1402918931398
and it fails with server error 500
.
Here is the sample 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 point me, how I can find out when URL
is changed?
It turns, that this is jQuery
caching feature.
If caching will be turned on in settings object, the issue 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");
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With