javascript - "undefined is not a function" onSuccessHandler -


i have problem in datasource file, on line onsuccesshandler( xmlrequest.responsetext ); here code

function initializehttprequest ( feedurl, onsuccesshandler, onerrorhandler ) {     var onloadhandler = function( ) {         if ( xmlrequest.readystate==4 && xmlrequest.status == 200 ) {             onsuccesshandler( xmlrequest.responsetext );         }       }; 

i use initializehttprequest in following way:

initializehttprequest(httpfeed, onsuccess(), onfailure());  // function onsuccess() { alert('true');}  //       function onfailure() { alert('true');} 

any json service call causing error "undefined not function" needed, spney sometime on it, , not familiar too.. thanks

remove parentheses. you're calling functions instead of calling initializehttprequest reference them:

initializehttprequest(httpfeed, onsuccess, onfailure); //                                       ^^         ^^ 

since both onsuccess , onfailure don't return values, return value undefined , error message.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -