Error: [Exception... "'Permission denied to call method
XMLHttpRequest.open' when calling method:
[nsIDOMEventListener::handleEvent]"

Usually you get this error when you are trying to do an ajax call to a different domain than the calling template is on. That's a no-no. There are ways around it, such as JSONP or using a server proxy.

-- Josh

----- Original Message ----- From: "Colin Manning" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Friday, July 04, 2008 8:45 AM
Subject: [jQuery] firefox error NS_ERROR_XPC_JS_THREW_STRING with ajax form submission



Hi

Have a problem that shows with firefox (2.0.0.15 on Windows) but not with
IE (6). I'm using the Form plugin with a trivial form. I'm using a call to
$.ajaxForm() to do an ajax form submission.

It never works with firefox, and instead I get this really user friendly
error message in the error console:
Error: [Exception... "'Permission denied to call method
XMLHttpRequest.open' when calling method:
[nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "<unknown>"  data: no]

Note, this is not fixed by sticking autocomplete="off"  into the input
controls (some versions of firefox seem to have bugs in autocomplete that
can lead to this kind of problem; adding autocomplete="off" is supposed to
work round that but it makes no difference here).


Here is a cutdown sample html that demos the problem. You'll note that I've set handlers on the ajaxForm() call to output the request and response, but
otherwise do nothing. When run on IE this does exactly what you'd expect -
you see an alert before the ajax request is sent, and another when the
response is received, and the page remains loaded in the browser. On
firefox the first alert appears ok but the response alert never shows,
instead you get the above error and the browser then changes the displayed
page to be the ajax response text from the server.

Any ideas?

--------------------------------------------------------------

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en-US" xml:lang="en-US">
<head>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script src="jquery.form.js" type="text/javascript"></script>
</head>

<body>

<form method="get" action="(url removed)" id="rc_form">
<input autocomplete="off" type="text" name="uv" />
<input autocomplete="off" type="submit" name=".submit" value="Search" />
</form>

<script type="text/javascript">
$(function(){
    $('#rc_form').ajaxForm({ beforeSubmit:
                                function(formData, jqForm, options) {
                                    var queryString = $.param(formData);
                                    alert('About to submit: \n\n' +
queryString);
                                    return true;
                                },
                             success:
                                function (responseText, statusText) {
                                    alert('status: ' + statusText +
'\n\nresponseText: \n' + responseText);
                                }
                          });
});
</script>
</body>
</html>


--------------------------------------------------------------


Thanks
Colin


At 22:08 16/06/2008, you wrote:


Hi

Newbie user and I guess this probably has a simple answer.

I have a hidden div on the page that is shown when user clicks a button.
Its a help text, in a div, for the page that is only to be shown when the
user wants it. But the page is long and when I un-hide the div I also want
the browser to scroll the document so as to ensure this div actually
visible within the browser window.

Is there an easy way in jQuery to ensure a given element is actually
visible on screen and not scrolled off the bottom?


Thanks
Colin


--
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008
18:02






--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008
18:02


--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.523 / Virus Database: 270.3.0/1503 - Release Date: 14/06/2008 18:02



Reply via email to