?
Solved

http_request.onreadystatechange = new Function (array???);

Posted on 2008-11-16
4
Medium Priority
?
769 Views
Last Modified: 2012-05-05
Hello,

I'm trying to call a function with an array and a string using "new Function" at http_request.onreadystatechange.

What is being missed at #####... or how to pass it.



...
        var mystring = "teststr";
        var myarr = new Array("testarr");
       	http_request.onreadystatechange = new Function('myFunc(#####)');
...
 
 
 
    function myFunc(arr, str) {
 
    }
........

Open in new window

0
Comment
Question by:BlueJ
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
kurijov earned 500 total points
ID: 22972279
http_request.onreadystatechange = function(){
  myFunc(arr, str);
  alert('myFunc has been called');
};

Have a nice day!
0
 
LVL 13

Expert Comment

by:Xyptilon2
ID: 22974218
Don't forget to check  the readyState as well (in addition to what Kurijov said):

http.onreadystatechange=function() {
    if(http.readyState == 4) {
      myFunc(arr, str);
      alert('myFunc has been called');
    }
  }

Goodluck!
0
 
LVL 13

Expert Comment

by:Xyptilon2
ID: 22974225
umz.. change http to http_request as per your own example :)
0
 

Author Closing Comment

by:BlueJ
ID: 31517290
:-)
Thanks! That was it.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 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