Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40391

Re: AJAX scope problem

From bill <william@TechServSys.com>
Newsgroups comp.lang.javascript
Subject Re: AJAX scope problem
Date 2021-09-18 14:22 -0400
Organization Aioe.org NNTP Server
Message-ID <si5apb$163a$1@gioia.aioe.org> (permalink)
References <si2ni7$1cge$1@gioia.aioe.org> <1k6gcpx667ja9.1szyt9uqb1722$.dlg@40tude.net> <1v6fu43pso1x7$.1puo9tieoc9l3$.dlg@40tude.net>

Show all headers | View raw


On 9/18/2021 11:41 AM, JJ wrote:
> On Sat, 18 Sep 2021 22:40:48 +0700, JJ wrote:
>>
>> Either the needed element has the wrong ID, or is served within an IFRAME.
> 
> Or is within a Shadow DOM.
> 

On 9/18/2021 11:41 AM, JJ wrote:
 > On Sat, 18 Sep 2021 22:40:48 +0700, JJ wrote:
 >>
 >> Either the needed element has the wrong ID, or is served 
within an IFRAME.
 >
 > Or is within a Shadow DOM.
 >
to explain in somewhat more detail:
I have 2 nested divs
The user enters data into a text box in the outer div.  This 
triggers a NEW XMLHtttpRequest which invokes a .php script.
  The output of the script lists the search data in the 2nd div 
with a button to edit the selected data item.

The button click calls a js function that calls another new 
XMLHtttpRequest which is serviced by another php script that puts 
the item's data back into a form in the 2nd div

The form contains data elements and a button to  call a js script 
to save the edited data.

That script fails because it can not find the form.

rather than copy the entire function I list only enough to show 
the failure.
------------------------------
function saveItem () {
   alert ("saveItem - entering 208")
   alert ("saveItem - " +
      document.getElementById("EditItemsForm"));

The both alerts are executed with the 2nd showing
"saveItem - " + null

If I change the EditItemsForm to another element that is not 
dynamically generated it does not fail; it returns the id.

Thank you very much for taking the time to read this.
-bill

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

AJAX scope problem bill <william@TechServSys.com> - 2021-09-17 14:42 -0400
  Re: AJAX scope problem JJ <jj4public@gmail.com> - 2021-09-18 22:40 +0700
    Re: AJAX scope problem JJ <jj4public@gmail.com> - 2021-09-18 22:41 +0700
      Re: AJAX scope problem bill <william@TechServSys.com> - 2021-09-18 14:22 -0400
        Re: AJAX scope problem JJ <jj4public@gmail.com> - 2021-09-20 22:14 +0700
  Re: AJAX scope problem bill <william@TechServSys.com> - 2021-09-18 14:44 -0400

csiph-web