0

I have the following code (in the <head> tag)

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<title th:unless="${pageTitle == 'TEMPLATE'}" th:text="${#strings.isEmpty(pageTitle) ? 'Broadleaf Demo - Heat Clinic' : pageTitle}"></title>

<title th:if="${pageTitle == 'TEMPLATE'}" th:remove="tag">
    <title th:inline="text" th:include="${templateName} :: title" />
</title>

<meta name="description" content="Broadleaf Demo Store" />
<meta name="author" content="Broadleaf Commerce" />

<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />   
<meta name="viewport" content="width=device-width" />

<blc:bundle name="style.css" 
            mapping-prefix="/css/"
            files="style.css,
                   jquery.rating.css,
                   autocomplete.css" />

<link rel="stylesheet" th:unless="${#strings.isEmpty(additionalCss)}" />
<script src="../../js/jquery-1.10.2.js" th:src="@{/js/jquery-1.10.2.js}"></script>
<script src="../../js/jquery-ui-1.10.4.custom.min.js" th:src="@{/js/jquery-ui-1.10.4.custom.min.js}"></script>

<script src="../../js/libs/modernizr-2.5.3.min.js" th:src="@{/js/libs/modernizr-2.5.3.min.js}"></script>

<blc:googleAnalytics th:attr="orderNumber=${order != null ? order.orderNumber : null}" />
<script th:utext="${analytics}"></script> 

I have searched all the Stackoverflow questions regarding this issue, I ain't able to find a solution for this, so I posted this question.

Here are the js files that have been loaded

enter image description here

First jQuery-1.9.1.js seems to be loading, so I removed the jQuery-1.10.2.js but I am getting $() is not defined error. I wasn't able to remove the jQuery-1.9.1.js as I don't know from where is it being loaded. There was no script tag that seems to load other js files that are loaded here.

Thanks in advance.

JavaTechnical
  • 8,846
  • 8
  • 61
  • 97
  • If you want to discuss a client-side problem, then please show client-side code as well – and not some template code, where no one here can know what the _actual_ rendered result of it will be. – CBroe Mar 17 '14 at 10:29
  • you add jquery library 2 times. Find and remove the first link the loads from live – Blu Mar 17 '14 at 10:34
  • @CBroe I couldn't myself find where this code resides, because I am new to Broadleaf commerce. – JavaTechnical Mar 17 '14 at 10:37
  • @BluAngel Yes, one seems to be loading from the Google CDN another one from the localhost. But I wasn't able to prevent loading that js file from Google CDN. – JavaTechnical Mar 17 '14 at 10:37
  • 1
    if in your pages JQuery library includes more than once then this type of problem occurs. if you have all files then search the text from all files 'ajax.googleapis....' – Blu Mar 17 '14 at 10:39
  • You did it Blu Angel!!!!!!! I got that, that is in footer.html, I removed it and it worked fine. Thank you very much!!!! – JavaTechnical Mar 17 '14 at 10:49
  • you welcome. I also added answer so the this thread completed. – Blu Mar 17 '14 at 11:36

2 Answers2

1

Make sure you have all the dependencies for jquery ui autocomplete -- it needs menu, widget, position, and ofcourse core (note if you're loading the whole UI library, no need to worry about this)

Lotus
  • 2,596
  • 1
  • 22
  • 20
0

In your files you add jquery library 2 times. Find and remove the first link the loads from live because if in your pages JQuery library includes more than once then this type of problem occurs. If you unable to find where the file included then find this text 'ajax.googleapis....' from all your files

Thanks

Blu
  • 4,036
  • 6
  • 38
  • 65