Splunk Search

Include outside javascript

xisura
Communicator

Hi All,

I have a jquery widget . I just want know to include/call all the javascript in a view.
In html it includes this way:




I tried to include it in progressbar.html




In view:

progressbar.html

It works but it shows some error like
unknown module:accountbar
unknown module:message
unknown module:appbar
unknown module:serversideincludes

How can i include all the js file without a conflict?

Tags (1)
0 Karma

LukeMurphey
Champion

The problem is that you included your own version of jQuery which is conflicting with the one that Splunk ships.

1. Use jQuery noConflicts mode

jQuery supports a mode call noConflict that allows you to use two version of jQuery without conflict. Mode info

2. Use Splunk's jQuery

You could try using Splunk's built-in version of jQuery. I'm guessing that you already tried this and found that this didn't work but it is worth a shot if you haven't tried it already.

3. Swap $

This solution is ugly so I don't recommend it if you can avoid it. You can replace $ with the newversion of jQuery temporarilly, and then swap it back. Here is an example:

<script src="/en-US/static/app/YOUR_APP/scripts/jquery.min.js"></script>
<script>
new_jquery = $;
old_jquery = $.noConflict(true);

$ = new_jquery; // Use the new jQuery for a moment
do_something_with_new_jquery();
$ = old_jquery; // Return to the original jQuery
<script>

xisura
Communicator

Hi LukeMurphy,

I will try the no conflict mode of jquery and the swap. I'll update you.Thanks again 🙂

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Mile High Learning with Splunk University, Denver, Colorado

If Denver is known for its mile-high elevation, Splunk University is about to raise the bar on technical ...

IT Service Intelligence 5.0 Series: Your Guide to the June Launch

We are excited to announce the June release of Splunk IT Service Intelligence (ITSI) 5.0. This update ...

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...