Hi guys,
I was hoping some one could help me with a problem im having with Ajax.
Im very new at Ajax and don't really understand it completely.
My current situation is as follows:
1: I have a main page which loads a flowchart.gif image.
2: Along side the flowchart image are small button images, they are also .gif. Each button relates to a procedure in the flowchart.
3: Each button image contains a hotspot link to another window using JavaScript.
4: All this is loaded using php and mysql which retrieves the buttons and flow chart from a database.
Now for the Ajax problem. When a user clicks a edit button a list of buttons appear on the page.
What I want to happen is when a user wants to add a button image to the current flow chart buttons he clicks on one of the buttons from the button list that appeared when the edit button was clicked and the button is added to the flowchart buttons.
Now at the moment I have managed to allow one button to be added to the flow chart buttons list using ajax, however, when I click on another button nothing happens.
I need the Ajax to keep adding the buttons the user clicks on to the flowchart buttons list. A sort of a recursive Ajax function!
Like I said im very new to ajax so I hope this is possible.
Below is my ajax.js functions:
function getXMLHttp()
{
var xmlHttp
try
{
//Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch(e)
{
//Internet Explorer
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser does not support AJAX!")
return false;
}
}
}
return xmlHttp;
}
function MakeRequest()
{
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
HandleResponse(xmlHttp.responseText);
}
}
xmlHttp.open("GET", "../ajax.php", true);
xmlHttp.send(null);
}
function HandleResponse(response)
{
document.getElementById('ResponseDiv').innerHTML = response;
}