eval() stopped working in FF

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sundevil
    New Member
    • Sep 2007
    • 1

    eval() stopped working in FF

    I have a script that is used to make ajax calls and it takes the callback function as a parameter. It then uses an eval to call that function with the responseText.
    [code=javascript]
    function makeHttpRequest (myURL, callbackFunctio n, returnXML, callType, parms)
    {
    .....
    http_request.on readystatechang e = function() {
    if (http_request.r eadyState == 4) {
    if (http_request.s tatus == 200) {
    if (callbackFuncti on) {
    if (returnXML) {
    eval(callbackFu nction + '(http_request. responseXML)');
    } else {
    eval(callbackFu nction + '(http_request. responseText)') ;
    }
    }
    .....
    [/code]
    This works fine in IE6/7 and was working last week in FF .6 and .7 but now it doesn't (no code changes). I installed the firebug extension this afternoon and then ran this again and it worked. I disabled the extension and it failed again (no errors in the regular console).

    Any help or ideas would be greatly appreciated.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You don't need to use eval. Use the function as an object - see this article.

    Comment

    Working...