[jQuery] firefox error NS_ERROR_XPC_JS_THREW_STRING with ajax form submission

[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