Splunk Dev

How to include custom jquery in app folder

kevintwingstrom
Engager

There is a requirement to update jquery on all custom apps and I just have a simple js file in /app/appserver/static/  that allows me to have tabs on my dashboards but now they're all broken because splunk only supports jquery 3.5 or above now.  So I opened a ticket and they told me to update jquery for my app.  Well I think the solution is to update jqeury on the server so when I use:

 

 

require(['jquery','underscore','splunkjs/mvc', 'bootstrap.tab', 'splunkjs/mvc/simplexml/ready!'],
                function($, _, mvc){blah blah blah

 

 

  it will pull the updated jquery from the servers.  However I can't do that because I'm on splunk cloud and can't update the jquery library on the server. So my question is how do I bundle a jquery.js file in my app, place it in the bin folder (or some other folder) and reference it in my require statement so that I can use an updated library?

Labels (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@kevintwingstrom 

It's batter to update custom app code for future purpose. But temporary you can point old Jquery Lib using below javascript code.

require.config({
    paths: {
        'jquery_old': 'PATH_OF_OLD_JQUERY_LIB'
    }
});

require([
    "underscore",
    "backbone",
    "splunkjs/mvc",
    "jquery_old",
    'splunkjs/mvc/simplexml/ready!'
], function(_, Backbone, mvc, $) {

});

 

I hope this will help you.

 

Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@kevintwingstrom 

It's batter to update custom app code for future purpose. But temporary you can point old Jquery Lib using below javascript code.

require.config({
    paths: {
        'jquery_old': 'PATH_OF_OLD_JQUERY_LIB'
    }
});

require([
    "underscore",
    "backbone",
    "splunkjs/mvc",
    "jquery_old",
    'splunkjs/mvc/simplexml/ready!'
], function(_, Backbone, mvc, $) {

});

 

I hope this will help you.

 

Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

kevintwingstrom
Engager

I got this figured out but I'm marking yours as a solution because this would clearly do the trick.  What I ended up doing is just referencing the mvc library for my jquery commands since jquery is included in the mvc library

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...