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!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...