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!

.conf24 | Registration Open!

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

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...