0
我使用Joomla-3
爲我的網站,我創建了一個簡單的小型JavaScript(ajax)
文件,我通過模板配置文件(如在模板的文檔中所見)附加。自定義Javascript不會運行在Joomla
我還在文章中添加了我的html
(沒有TinyMCE
等,所以我知道它接受我的代碼)。該腳本在簡單的.html
或.php
文件中工作正常,但它不能與Joomla
一起使用。
我的腳本有2個依賴的ajax
下拉菜單(靜態內容)。你有什麼想法可以出錯?
預先感謝您!
PS。你可以找到我的JavaScript代碼here。
下面的代碼:
$(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 to select a 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;
});
});
});
什麼螢火蟲顯示你..? – 2013-04-09 03:55:20
我該如何檢查? 如果我輸入控制檯「jQuery(」#services「)。change('service1');」,它只是返回「[select#services.classselect]」 – manosim 2013-04-09 04:00:11
我已經打開它,但不知道是什麼尋找。抱歉。 – manosim 2013-04-09 04:02:28