Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 678575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:09:53+00:00 2026-05-14T01:09:53+00:00

trying to make a page which will recursively call a function until a limit

  • 0

trying to make a page which will recursively call a function until a limit has been reached and then to stop. It uses an ajax query to call an external script (which just echo’s “done” for now) howver with neither onSuccess or onFailure triggering i’m finding it hard to find the problem.

Here is the javascript for it. In the header for the webpage there is a script to an ajax.js document which contains the request data. I know the ajax.js works as I’ve used it on another website

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>National Lettings Inventories</title>
    <link   type="text/css"       href="/inv/default.css" rel="stylesheet" />
    <script type="text/javascript" src="/inv/includes/swfobject.js"></script>
    <script type="text/javascript" src="/inv/includes/ajax.js"></script>
    <script type="text/javascript">
        swfobject.registerObject("myFlashContent", "9.0.0");
    </script>
</head>
<body onload="start()">
    <div id="topBar">
        <div class="logo">            
        </div>
    </div>
    <div id="Body">
<script type="text/javascript">
<!--

var rooms = 1;
var items = 0;
var ccode = "9999/1";

var x = 0;

function echo(string,start){
    var ajaxDisplay = document.getElementById('ajaxDiv');
    if(start)
        {ajaxDisplay.innerHTML = string;}
    else
        {ajaxDisplay.innerHTML = ajaxDisplay.innerHTML + string;}
}

function locations()
{
    echo("Uploading location "+x+" of " + rooms,true);
    Ajax.Request("Perform/location.php",
    {
        method:'get',
        parameters: {ccode: ccode, x: x},
        onSuccess: function(reply)
        {alert("worked");
            if(x<rooms)
            {
                x++;
                locations();
            }
            else
            {
                x=0;
                echo("Done",true);
            }
        },
        onFailure: function()
        {alert("not worked");
             echo("not done");
        }
    });
    alert("boo");
}

function start()
{locations();}
//-->
</script>

Uploading

<div id='ajaxDiv'>

</div>
        </div>
                <div class="link" id="bottom">
            <a href="index.php" ><img src="/inv/images/back.gif" class="link" alt="BACK"/></a>
        </div>
                <div id="bottomBar">
            <p>Copyright © 2010 National Lettings Inventories</p>
        </div>
     </body>
</html>

Opera Error Console

JavaScript - http://localhost/inv/Upload/upload.php
Event thread: load
Error:
name: TypeError
message: Statement on line 89: Cannot convert undefined or null to Object
stacktrace: n/a; see  opera:config#UserPrefs|Exceptions Have Stacktrace

Any help or advice will be most appreciated.

EDIT: Added the whole page source code, theres no line 89 here though

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:09:54+00:00Added an answer on May 14, 2026 at 1:09 am

    I don’t notice anything obviously wrong with your code*. But the fact that last alert (after the call) doesn’t fire is a pretty good indicator that the call caused the javascript engine to fail. Have you tried using firebug (or similar) and see what happens on the console?

    The onSuccess and onFailure callback will only be called if the call is actually fired. If the script fires an exception, or (since javascript is usually interpreted directly) encounters a syntax error etc. the script engine will usually stop running the script and pop a error message to the javascript console (wich is not allways obviously indicated by the browser). If the script stops before or during the call the callbacks of course won’t fire.

    EDIT:
    Sounds like you accidentally use an uninitialized variable, somehow. Try double checking that you’ve typed all variables correctly (including case). Not really sure what’s happening as I cannot see what’s on line 89…

    EDIT: I just noticed, you’ve written Ajax.Request(... not new Ajax.Request(... as in the tutorial on the prototype site. Not sure if it matters, though…

    (* Though the uppercase letter in the path looks a bit suspicious; not really wrong, but might look like you accidentally uppercased the first letter. Usually best not to require uppercase in url’s in case some browser munges it.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 367k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer if you have a lots of elements on the stage,… May 14, 2026 at 4:47 pm
  • Editorial Team
    Editorial Team added an answer The essential problem here is that you have a <xs:sequence>… May 14, 2026 at 4:47 pm
  • Editorial Team
    Editorial Team added an answer Have you looked at using nailgun? It sets up a… May 14, 2026 at 4:47 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.