Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

not implemented error: javascript/ajax in asp page

Posted on 2007-04-06
4
Medium Priority
?
528 Views
Last Modified: 2008-01-09
hiya experts...

I have a little problem with an asp/ajax/javascript script.....

i know this statement works:
xmlhttp.onreadystatechange=loadList;

the problem is i have about 20 different situations to check for and i can do something like this to call the right "loadlist":
eval("xmlhttp.onreadystatechange=loadList"+theList);
where "theList" is the current list needed. Only problem is that i need to create 20 or so functions called
loadlistSOMETHING() .....

i tried various ways to send an argument to loadlist like:
xmlhttp.onreadystatechange=loadList("something");
or
xmlhttp.onreadystatechange=loadList(varforlist);

but i get a "not implemented" error...

can you not send arguments to this type of function??

function loadList(theList) {
      if (xmlhttp.readyState==4) {
          if (xmlhttp.status==200) {
                   document.getElementById(theList).innerHTML=xmlhttp.responseText;
        }
    }
}


thanks,
rich
0
Comment
Question by:razzzzer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
stanscott2 earned 500 total points
ID: 18868009
When you set the onreadystatechange event this way, no, you CAN'T send an argument.  However, that doesn't mean you can't do something like this:

var theList;

function doTheXMLHTTP() {
      theList = something;
      xmlhttp.onreadystatechange = loadList;
}

function loadList() {
     document.getElementById(loadList).innerHTML = xmlhttp.responseText;
}

Just set up your list as a global variable, in other words, so you don't need to pass it directly to the other function.
0
 

Author Comment

by:razzzzer
ID: 18868020
do ya mean
document.getElementById(theList).innerHTML = xmlhttp.responseText;
instead of
document.getElementById(loadList).innerHTML = xmlhttp.responseText;


0
 
LVL 15

Expert Comment

by:stanscott2
ID: 18868041
yes
0
 

Author Comment

by:razzzzer
ID: 18868050
that seems like it would work just fine...

thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question