Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Stop function

Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
New one
New one

Joined: 27 Jan 2008
Posts: 1

PostPosted: Sun Jan 27, 2008 3:15 pm    Post subject: Stop function Reply with quote

Hi, I have a ajax script which is modifying a textarea onChange; While I'm getting back the response a span is indicating above the specific textarea that the data is loading;
The textarea's id's are comm100, comm101, comm102 and so on and the corresponding span for loading are marked mem100 ... you get it....
When updating the first textarea everything works perfect - The Loading span is showing the message, the message disappears then the txt area is updated;
The problem arises when the second area gets updated;
The second area's span and textarea are working fine but the first area's span will indicate the "Loading" message and would remain like that;
The problem will gradualy arise for every next area I would be updated.
Here's the script I use:


function selectID(id, comm ) {  // This function does the AJAX request

  //  Set our destination PHP page
  http.open("POST", "http://myurl/ajax/post.php", true);
  http.onreadystatechange = getHttpRes;

  // Make our POST parameters string…
  var params =
   "id=" + encodeURI(id)+
   "&comm=" + encodeURI(comm);

  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…

      function getHttpRes( ) {
           if (http.readyState < 4) {
            document.getElementById("mem" + id).innerHTML="Loading..";}

           if (http.readyState == 4 && http.status == 200) {
                res = http.responseText;  // These following lines get the response and update the page
               if (res == "expired"){
                  alert ("Session expired \n Relogin")}
            document.getElementById("mem" + id).innerHTML="";
            document.getElementById("txt" + id).value = res;



function getXHTTP( ) {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
        // This block handles Mozilla/Firefox browsers...
       try {
         xhttp = new XMLHttpRequest();
       } catch (e3) {
         xhttp = false;
  return xhttp; // Return the XMLHTTP object

var http = getXHTTP(); // This executes when the page first loads.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 XML & Copyright Notice 

Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X

Link to our site:


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos

Normal Bookmark

Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax

Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?

it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert