Я создал модуль от https://github.com/Joomla-Ajax-Interface/Ajax-Session-Module (Ajax-Session-Module), загрузил его на мой сайт и да, он делает то, что показал пример: добавлено значение, удалено значение и удалены все значения.новый XMLHttpRequest в joomla 3
Как использовать этот модуль для запроса в Joomla. Я знаю, что этот код отлично работает за пределами Joomla.
//AJAX - Creates the XMLHttpRequest that sends a http request to the web server
function getXMLHTTP() {
var x = false;
try {
x = new XMLHttpRequest();
}
catch(e) {
try {
x = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(ex) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1) {
x = false;
}
}
}
return x;
}
//AJAX - Retrieves the teams based on the division choice
function leagueABCD(strURL) {
var rer = getXMLHTTP();
if (rer) {
rer.onreadystatechange = function() {
if (rer.readyState == 4) {
if (rer.status == 200) {
document.getElementById("homeTeam").innerHTML=rer.responseText;
<!--alert(rer.responseText);-->
}
else {
alert("There was a problem while using XMLHTTP:\n");
}
}
}
rer.open("GET", strURL, true);
rer.send(null);
}
}
//AJAX - Retrieves the players based on the home team choice
function homeTeam(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById("playersHomeTeam").innerHTML=req.responseText;
<!--alert(req.responseText);-->
}
else {
alert("There was a problem while using XMLHTTP:\n");
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
//AJAX - Retrieves the players based on the visiting team choice
function visitingTeam(strURL) {
var vt = getXMLHTTP();
if (vt) {
vt.onreadystatechange = function() {
if (vt.readyState == 4) {
if (vt.status == 200) {
document.getElementById("playersVisitingTeam").innerHTML=vt.responseText;
<!--alert(vt.responseText);-->
}
else {
alert("There was a problem while using XMLHTTP:\n");
}
}
}
vt.open("GET", strURL, true);
vt.send(null);
}
}
//AJAX - Retrieves the current rating based on the player choice
function idP(strURL) {
var rer = getXMLHTTP();
if (rer) {
rer.onreadystatechange = function() {
if (rer.readyState == 4) {
if (rer.status == 200) {
document.getElementById("ratingC").innerHTML=rer.responseText;
<!--alert(rer.responseText);-->
}
else {
alert("There was a problem while using XMLHTTP:\n");
}
}
}
rer.open("GET", strURL, true);
rer.send(null);
}
}
В файле default.php, откуда генерируется «мини-форма». Любая помощь была бы потрясающей.
Спасибо, Роберт
Очевидно, моя проблема была здесь в форме ...