Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
| Search | Today's Posts | Mark Forums Read
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 27th, 2006, 05:16 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Firefox javascript error

am using the following code where it is giving me an "Undefined" error
in Firefox while it is running well on IE, the line which cuz the error is "XHR.open("GET",url,true);", any idea ????

var XHR;
function BuildXHR(url)
{
    if (window.XMLHttpRequest)
    {
    XHR = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
    XHR = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (XHR == null)
    {
    alert ("Browser does not support HTTP Request");
        return;
    }

    XHR.onreadystatechange = StateChanged;
    XHR.open("GET",url,true);
    XHR.send(null);
}

  #2 (permalink)  
Old November 27th, 2006, 10:11 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

What is it saying is undefined?

Is there more code? Where is the function StateChanged defined?






Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
  #3 (permalink)  
Old November 27th, 2006, 10:57 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i found the solution, there is something about "cross domain' call, i was calling a page in another domain where
Firefox it seems prevent doing that, but i found the the following code which let me do it but an alert will appear:

try
{
   netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead");
}
catch(e)
{
   alert("Permission UniversalBrowserRead denied.");
}



Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox vs. IE - Javascript problem VerbatimBOT ASP.NET 2.0 Professional 2 September 25th, 2008 03:28 AM
Javascript - Firefox is not supporting lakshmi252002 General .NET 0 April 17th, 2007 12:14 AM
How To Close firefox Window through javascript jitendersingal ASP.NET 1.0 and 1.1 Basics 1 February 13th, 2006 07:36 PM
How To Close firefox Window through javascript jitendersingal BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 February 10th, 2006 05:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.