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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...