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

  • SEARCH
  • Home
  • 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 87485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:24:37+00:00 2026-05-10T22:24:37+00:00

I had a realtivley simple ajax application, which I have broken up to be

  • 0

I had a realtivley simple ajax application, which I have broken up to be more modular. The code is at the link below, and what I have mainly done is add the GetRecordSet function and allowed fetchcompelte to take a variable for which layer to put data in. It should work fine in thery. When I put alert()s in, the code seems to execute, except for inside either of the if clauses in fetchcomplete.

http://www.nomorepasting.com/getpaste.php?pasteid=22558

This is the code for get_records.php, which again seems like it should be fine

http://www.nomorepasting.com/getpaste.php?pasteid=22559

and this is the original index php file

http://www.nomorepasting.com/getpaste.php?pasteid=22560

  • 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. 2026-05-10T22:24:37+00:00Added an answer on May 10, 2026 at 10:24 pm

    Firsly I would agree with Shyam and also install Firebug for Firefox; this will be a huge help for javascript debugging.

    anyway, the line

    xmlHttp.onreadystatechange = FetchComplete(layername); 

    will assign the result of FetchComplete(layername) to xmlHttp.onreadystatechange, which isn’t what you want. It would need to be

    xmlHttp.onreadystatechange = FetchComplete; 

    But then you have the problem of passing layername.

    If you define the onreadystatechange as an anonymous inner function you can easily use variables defined outside it, so you could do something like this:

    function GetAuctionData(pk) {      var xmlHttp=GetXmlHttpObject();     var layer = 'Layer2';      if(xmlHttp==null) {         alert('Your browser is not supported?');     }      var url='get_auction.php?';     url=url+'cmd=GetAuctionData&pk='+pk;     url=url+'&sid='+Math.random();      xmlHttp.onreadystatechange = function() {         if(xmlHttp.readyState==4 || xmlHttp.readyState=='complete') {             document.getElementById(layer).innerHTML=xmlHttp.responseText         } else if (xmlHttp.readyState==1 || xmlHttp.readyState=='loading') {             document.getElementById(layer).innerHTML='loading'         }     };      xmlHttp.open('GET',url,true)     xmlHttp.send(null) } 

    layer is defined as a local variable in GetAuctionData() but is accessible in the anonymous function, because you are creating a Closure. Note that I haven’t tested the above function, but it should work in principle.

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

Sidebar

Related Questions

I have a VB6 application (please don't laugh) which does a lot of drawing
A relatively simple question. I have a datagridview, which all it does is displays
I have a WPF application and I need to print from it. I had
I have a relatively simple DSL that I would like to handle more robustly
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had a question in MySQL, did it correctly. But the book code differs
Relatively new to C#; hopefully I'm just overlooking something simple. I have a form
I have a number of relatively simple (auto-generated) graphs in graphviz dot format. These
I am trying to compile a relatively simple, client-side-only GWT 2.5.0 application under JDK
I've recently set some coursework for some undergraduate students for which they have to

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.