PDA

View Full Version : Element.load not firing in Firefox 3.6.3



dduffy
4 May 2010, 1:57 PM
Hi there, I have created the following code all working Fine in IE 8 but will not firein Firefox.

here us my code, the URL in question simply returns the name in the name parameter. I am just testing out an ajax call to my procedure, it does not register an access log on my Apache server, IE works with no problems

any help much appreciated. I am new to EXTJS.

Darragh

function begin_processing() {

Ext.get('okButton').on('click', function(){
var msg = Ext.get('msg');
msg.load({
url: 'http://localhost:8080/core/cp_home_page', // <-- replace with your url
params: 'name=' + Ext.get('name').dom.value,
text: 'Updating...'
});
msg.show();
});


}

dduffy
4 May 2010, 1:58 PM
FF Version 3.6.3

dduffy
4 May 2010, 10:59 PM
EXTJS version 3.x

Animal
4 May 2010, 11:12 PM
Does Firebug show errors?

dduffy
4 May 2010, 11:51 PM
Getting no JS error in FF, but getting an Error in the Net tab of FF. Getting a status Error of
"501 Method Not Implemented" which I have just noticed.

This is very stange becuase I use Prototype.JS all the time to implement AJAX calls, which is done very similarly. coupled with that it works all OK in IE.

I can call the URL directly via Get (I changed servers since my orginal post)
http://portaldev.adtest.com/pls/coreportal20/cp_home_page.my_home?p_name=darraghaaaa

Darragh

evant
5 May 2010, 12:16 AM
Is the request being set as a POST or a GET? What happens if you change the params:



params: {
name: Ext.getDom('name').value
}

evant
5 May 2010, 12:20 AM
Also, you might want to check the content type of the request too and see if it's allowed by your webserver.

dduffy
5 May 2010, 4:11 AM
Hi Evan,

I changed the parameter as suggested:
function begin_processing() {

Ext.get('okButton').on('click', function(){
var msg = Ext.get('msg');
msg.load({
url: 'http://portaldev.adtest.com/pls/coreportal20/cp_home_page.my_home', // <-- replace with your url
params: {p_name: Ext.getDom('name').value},
text: 'Updating...'
});
msg.show();

and I pulled out the Request Header from Firebug:
OPTIONS /pls/coreportal20/cp_home_page.my_home HTTP/1.1
Host: portaldev.adtest.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Origin: http://localhost
Access-Control-Request-Method: POST
Access-Control-Request-Headers: x-requested-with

I cant see anything obvious wrong - any ideas?

Darragh.

dduffy
5 May 2010, 4:18 AM
Hi evan,

I found another thread in the forum http://www.extjs.com/forum/showthread.php?70675-HTTP-501-Not-Implemented

suggesting that mod_security might be causing the problem, I do have mod_security turned on with one of my servers, I will tried to tweak, but still this does not explain why IE8 works and FF does not.

Darragh

dduffy
5 May 2010, 4:38 AM
Hi evan, I think I might have found a different

I checked the access.log in Apache and have the following when instigated by FF 3.6.3
192.168.1.111 - - [05/May/2010:13:00:48 +0100] "OPTIONS /pls/coreportal20/cp_home_page.my_home HTTP/1.1" 501 413

again indicating a 501 Error, so FF is firing the event, however I perform the operation via IE 8 the following is in the log

192.168.1.111 - coreportal [05/May/2010:13:29:35 +0100] "POST /pls/coreportal20/cp_home_page.my_home HTTP/1.1" 200 28

So there is a different with POST v's OPTIONS, I will be honest I do not know what OPTIONS are.

Darragh

Animal
5 May 2010, 5:07 AM
Are you serving that page from http://localhost:8080/ ?

dduffy
5 May 2010, 5:25 AM
Hi animal,

nope starting from http://localhost/

I have two webservers running one on port 80 and another on port 8080.

But i have also tried doing from "http://localhost" to
"http://portaldev.adtest.com/pls/coreportal20/cp_home_page.my_home"

Darragh

evant
5 May 2010, 5:45 AM
You can't do Ajax requests cross domain, because of the same origin policy: https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript

A different port is considered to be a different server. Why it works on IE? Not sure.

dduffy
5 May 2010, 7:23 AM
thanks Evan, I / we had come to the same conclusion, so I am going to set up another Test Case and see how I get on.

Darragh

dduffy
18 May 2010, 9:25 AM
I finally got back to checking this out. All is now working, problem was as suggested by Evan.T i.e. Cross domain ajax call. Found it intersting that IE 8 allowed it.

Thanks for your help