jquery - Custom Javascript Won't Run in Joomla -
i using joomla-3
websites , have created simple small javascript(ajax)
file attached through template config file(as seen on template's documentation).
i added html
in article(without tinymce
etc know accepts code). script works fine in simple .html
or .php
file doesn't work along joomla
.
my script has 2 dependent ajax
dropdown menus(static content). have ideas on go wrong?
thank in advance!
ps. can find code of javascript here.
here's code:
$(window).load(function () { var services = []; services['service1'] = [{ "name": "giannis", "url": "giannis" }, { "name": "kostas", "url": "kostas" }, { "name": "fillipos", "url": "fillipos" } ]; services['service2'] = [{ "name": "maria", "url": "maria" }, { "name": "peter", "url": "peter" }, { "name": "jack", "url": "jack" } ]; services['service3'] = [{ "name": "dimitris", "url": "dimitris" }, { "name": "takis", "url": "takis" }, { "name": "gianna", "url": "gianna" } ]; jquery(document).ready(function () { jquery("#services").change(function () { var selectedservice = $(this).val(); $('#doctors').children().remove(); $('#doctors').append('<option value="null">click select doctor</option>'); jquery.each(services[selectedservice], function (ind, val) { $('#doctors').append('<option value="' + this.url + '">' + this.name + '</option>'); }) }); jquery("#doctors").change(function () { var redirserv = $('#services option:selected').val(); var thepersonobject = services[redirserv]; var gothere = $(this).val(); var fullurl = 'http://www.website.com/our-services/' + redirserv + '/item/' + gothere; alert(fullurl); //location.href = 'http://www.website.com/our-services/' + redirserv + '/item/' + gothere; }); }); });
tried this? $(window).on(‘load’, function(){ // awesomeness })
Comments
Post a Comment