However, sometimes it is required to pass one or more parameters to this anonymous function. It sounds tricky but it is pretty simple! This anonymous function can not take parameters but it can call another function defined in the same file and pass parameters to it. So, if you want to pass parameters to the anonymous function -you can do it as below: Isn’t it pretty clever solution?! It is like taking a bit long route -but this route is not all that difficult -is it? Hope this helps you and save you time. Let me know how you liked this tip. Thank you for using TechWelkin. var parameter1 = “Something”; for (var i =0; i < 100; i++) { var _parameter1 = parameter1; xmlHttp.onreadystatechange=function () { stateChanged(_parameter1, parameter2); }; xmlHttp.open(“GET”, handlingURL, true); xmlHttp.send(null); } } I spend to mauch time to solve this situation BUT … xmlHttp.onreadystatechange=haberD(bak); DOWS NOT WORK (FUCK OF 2 hour …:) :))) You realy helped me. THANKS. I found yor from google by typing:xmlHttp.onreadystatechange function THANKS FROM TURKEY … Comment * Name * Email * Website
Δ