[Javascript] AJAX stopping

Michael Borchers list at tridemail.de
Tue Aug 15 06:01:21 CDT 2006


it looks a bit confusing but here are some of my functions that use php 
files. the files themselves worke fine.

f.e. i can throw out the insertFolder or the refreshFolders function in 
addFolder, each one alone works fine, but together none of them works.

could it be a problem with 2 httpRequest calls or the httpReques.send(null) 
?!


function addFolder()
{
 var foldName = prompt('enter name:');

 if(foldName != null && foldName != '' && foldName != 'undefined')
 {
  insertFolder(foldName);
 }

 refreshFolders();
}

function insertFolder(foldName)
{
 httpRequest.open('get', 
'ajax.php?ajax_filename=insert_folder.php&folders_name=' + foldName, true);
 httpRequest.onreadystatechange = function() { alertResponseText() };
 httpRequest.send(null);
}

function refreshFolders()
{
 getFolders();
}

function getFolders()
{
 httpRequest.open('get', ''ajax.php?ajax_filename=show_folders.php', true);
 httpRequest.onreadystatechange = function() { showFolders() };
 httpRequest.send(null);
}

function showFolders()
{
 var ticketsFoldersDiv = document.getElementById('ticketsFoldersDiv');

 if(httpRequest.readyState == 4)
 {
  ticketsFoldersDiv.innerHTML = httpRequest.responseText;
 }
}

function alertResponseText()
{
 if(httpRequest.readyState == 4)
 {
  if(httpRequest.status == 200)
  {
   alert(httpRequest.responseText);
  }
 }
} 




More information about the Javascript mailing list