473,624 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running AJAX function in parent window from child

2 New Member
I have a main window containing a list of items along with some buttons. If the user clicks the 'View' button, I open a child window containing the details of the item along with 'Approve' and 'Reject' buttons.

What I'm trying to do is if the user presses the 'Approve' button on the child window, then the parent window is updated via an AJAX function within the parent's <SCRIPT> tags and the child window is closed.

I've tried running the parent function from the child window via window.opener.l oadApprovalList () (which does run) but it returns an error stating '[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_A VAILABLE) [nsIXMLHttpReque st.status]" nsresult: "0x80040111 (NS_ERROR_NOT_A VAILABLE)" location: "JS frame :: http://localhost/cgi-bin/functions.js :: parseApprovalLi st :: line 171" data: no]

Any ideas what's going on?
Dec 14 '07 #1
3 2087
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

Post the code for loadApprovalLis t().
Dec 14 '07 #2
jack21
2 New Member
I've narrowed the problem down to this:

it appears that once I perform a document.x.subm it() and then try to do an xmlhttp.open, the browser (only tested with FF at this juncture) does a submit().

Anyway, here is the relevant code:

Expand|Select|Wrap|Line Numbers
  1. function postDoc(data,func)
  2.   var url='/cgi-bin/ajax.js';
  3.  
  4.   // Mozilla, etc.
  5.   if (window.XMLHttpRequest)
  6.   { xmlhttp=new XMLHttpRequest();
  7.     xmlhttp.onreadystatechange=func;
  8.     xmlhttp.open("POST",url,true);
  9.     xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  10.     xmlhttp.send(data);
  11.   }
  12.   // IE
  13.   else if (window.ActiveXObject)
  14.   { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  15.     if (xmlhttp)
  16.     { xmlhttp.onreadystatechange=func;
  17.       xmlhttp.open("POST",url,true);
  18.       xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  19.       xmlhttp.send(data);
  20.     }
  21.   }
  22. }
  23.  
  24. function loadApprovalList()
  25. {
  26.   postDoc('function=listApprovals',parseApprovalList);
  27. }
  28.  
Note: I'd post the parseApprovalLi st function, but it never gets called!
Dec 14 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
The error is in parseApprovalLi st, line 171.
Dec 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
20385
by: Filiz Duman | last post by:
Is it possible to call a javascript function based in the parent window from the child window ? I do open a pop up window from the parent window with: newwindow = window.open (...) and assign a value from the child window to the parent window text field: opener.document.forms.elements.value = valuename;
2
7877
by: Reply Via Newsgroup | last post by:
Folks, I was sure this could be done - or at least sure I had seen reference to it at some point or other - but now, after having gone for a cup of tea, am begining to doubt my original belief. Can I have a script, available in a parent function, called from a child window? If so, how? And... if so, why? I mean, while sipping my tea, I realised that if the
2
23492
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent window to open a child window thru javascript window.open 2) I have some functionality in the child window that changes the data
4
5123
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the child window. The function that is called contains an XMLHttpRequest. My problem is that everything happens as it should, the innerHTML is changed by the results of the XMLHttpRequest and the child window closes. The problem is this, in Firefox,...
4
2533
by: Rob Meade | last post by:
Hi all, I played with my first bit of AJAX the other week and was pleasantly surprised that I achieved my goal..now I'd like to try something else.. Question... If I have an updatePanel, and lets say I have a button as a trigger which runs a function in my code behind to add a textbox to the updatePanel, when the form is submitted does this control actually "exist" as such on the
3
1696
by: jaynick | last post by:
Hello, everyone! I'm hoping that someone in this forum will be kind enough to help me out. I am having a Javascript issue related to Ajax and I just can't seem to figure it out. I am currently using the following Javascript code for Ajax purposes and it works perfectly: <script language = "javascript"> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if...
2
4652
by: mndprasad | last post by:
Hi friends, Am new to AJAX coding, In my program am going to have two texbox which going to implent AJAX from same table. One box is going to retrieve the value of other and vice versa. I have implemented successfully for one text box, but it's done for the other field, since am getting script errors. <script> var queryField; var lookupURL; var divName;
22
3811
by: V S Rawat | last post by:
(bringing the discussion here for php.general) I am on xpsp3, wampserver 2.0, having apache 2.2.8, php 5.2.6, MySQL 5.0.51b. http://localhost/ is E:\wamp\www\ I have put the first php script to hello.php file: <html> <head> <title>PHP Test</title>
29
3895
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a section of the page. This is the JavaScript code that I'm using to refresh the content in the parent page: <script type="text/javascript"> function UpdateList() {
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.