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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...