473,668 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX Not Working In Firefox

I have the following javascript which works in either IE or Firefox but
not on both.

When I set the code to

http_request.op en('POST', url, true) - Works in IE only
http_request.op en('GET', url, true) - Works in Firefox only; Does not
refresh in IE.

How do I resolve this?

Thanks in advance.
=============== =============== =======

The page that uses AJAX is http://www.ubelt.com

http://www.ubelt.com/ub/apps/ajax/ajaxlatestphotos.js (for Full Code)

function makeHttpRequest (url, callback_functi on, return_xml)
{
var http_request = false;

if (window.XMLHttp Request) { // Mozilla, Safari,...
http_request = new XMLHttpRequest( );
if (http_request.o verrideMimeType ) {
http_request.ov errideMimeType( 'text/xml');
}

} else if (window.ActiveX Object) { // IE
try {
http_request = new ActiveXObject(" Msxml2.XMLHTTP" );
} catch (e) {
try {
http_request = new ActiveXObject(" Microsoft.XMLHT TP");
} catch (e) {}
}
}

if (!http_request) {
alert('Unfortun atelly you browser doesn\'t support this
feature.');
return false;
}
http_request.on readystatechang e = function() {
if (http_request.r eadyState == 4) {
if (http_request.s tatus == 200) {
if (return_xml) {
eval(callback_f unction +
'(http_request. responseXML)');
} else {
eval(callback_f unction +
'(http_request. responseText)') ;
}
} else {
//alert('There was a problem with the request.(Code: ' +
http_request.st atus + ')');
}
}
}
http_request.op en('POST', url, true);
http_request.se nd(null);
}

Jul 18 '06 #1
5 8126
Guestion why don't u use prototype? pretty easy and it work's in every
browser.

http://wiki.script.aculo.us/scriptac...show/Prototype

example:
new Ajax.Updater('m ydiv', '/foo/bar', {method:'post',
postBody:'thisv ar=true&thatvar =Howdy', asynchronous:tr ue,
evalScripts:tru e});

evalScripts on the end means that when the ajax page you are calling
contains for example <script>alert(' hello');</scriptit will execute
that the other stuff just echo't will be outputted to mydiv.

i give you this because i stoped using my own crap because this stuff
is alway's working

Hope this helps

Danny R wrote:
I have the following javascript which works in either IE or Firefox but
not on both.

When I set the code to

http_request.op en('POST', url, true) - Works in IE only
http_request.op en('GET', url, true) - Works in Firefox only; Does not
refresh in IE.

How do I resolve this?

Thanks in advance.
=============== =============== =======

The page that uses AJAX is http://www.ubelt.com

http://www.ubelt.com/ub/apps/ajax/ajaxlatestphotos.js (for Full Code)

function makeHttpRequest (url, callback_functi on, return_xml)
{
var http_request = false;

if (window.XMLHttp Request) { // Mozilla, Safari,...
http_request = new XMLHttpRequest( );
if (http_request.o verrideMimeType ) {
http_request.ov errideMimeType( 'text/xml');
}

} else if (window.ActiveX Object) { // IE
try {
http_request = new ActiveXObject(" Msxml2.XMLHTTP" );
} catch (e) {
try {
http_request = new ActiveXObject(" Microsoft.XMLHT TP");
} catch (e) {}
}
}

if (!http_request) {
alert('Unfortun atelly you browser doesn\'t support this
feature.');
return false;
}
http_request.on readystatechang e = function() {
if (http_request.r eadyState == 4) {
if (http_request.s tatus == 200) {
if (return_xml) {
eval(callback_f unction +
'(http_request. responseXML)');
} else {
eval(callback_f unction +
'(http_request. responseText)') ;
}
} else {
//alert('There was a problem with the request.(Code: ' +
http_request.st atus + ')');
}
}
}
http_request.op en('POST', url, true);
http_request.se nd(null);
}
Jul 18 '06 #2
another thing...

stuff like this:
document.getEle mentById('ajax-latestphotos'). innerHTML = html_content;

will become this:
$('ajax-latestphotos'). innerHTML=html_ content

Jul 18 '06 #3
Sjigger said the following on 7/18/2006 4:57 AM:
Guestion why don't u use prototype?
You should search the archives for articles about prototype.
pretty easy and it work's in every browser.
No it doesn't.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 18 '06 #4

Thanks for the response.

However, any of you guys know why this isn't working on both browsers?
Is there an alternative code that works on both?

Randy Webb wrote:
Sjigger said the following on 7/18/2006 4:57 AM:
Guestion why don't u use prototype?

You should search the archives for articles about prototype.
pretty easy and it work's in every browser.

No it doesn't.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 18 '06 #5

Danny R написав:
if (return_xml) {
eval(callback_f unction +
'(http_request .responseXML)') ;
} else {
eval(callback_f unction +
'(http_request .responseText)' );
}
You can use http_request.re sponseXML only for appointed content type:

var respType = http_request.ge tResponseHeader ("Content-Type");
if (respType == 'text/xml')
{
// process http_request.re sponseXML
}
else
{
// process http_request.re sponseText
}

Does not refresh in IE.
It may be caused by caching.
Simple solution were posted here
http://groups.google.com.ua/group/co...33ea0f52689067

Instead of
var url = '/ub/apps/ajax/latestphotosxml .aspx';
use
var url = '/ub/apps/ajax/latestphotosxml .aspx?'+ Math.random();

Jul 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20066
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url, {method: 'post', parameters:
4
7458
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act accordingly. Now, the way to replace the current document with a new one used to be easy and...
3
2976
by: noballack | last post by:
I've got a problem, I'm working with Ajax in a web with a form with a list of checkbox added to the form via an Ajax.Updater method. These added checkboxs are not been sended by the form if I use Firefox or Safari. My source code is something like that: <script type="text/javascript" src="http://www.my_web_page.com//js/prototype-1.4.0.js"></script> <script> function showMoreOptions( url, pars, div_id ){ if...
25
2785
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever find. We are going to use the prototype feature ajax.Updater (see part one for more details on prototype).
5
2713
by: Steve Wright | last post by:
I have an AJAX routine on a webpage that is working in IE6, but not IE7 or Firefox v2.0.0.2 The webpage is http://www.a-drop-in-the-ocean.co.uk/CWS/monitor10bins.php?quarry=401 The AJAX routine is encapsulated in the module http://www.a-drop-in-the-ocean.co.uk/CWS/js/timer.js
8
3134
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox" post. Third, there are pieces of this code that I am not at liberty to display, change, discuss, or re-implement. As far as this question is concerned, this means that (1) I cannot use 3rd party libraries, which is why I've implemented my own...
29
3303
by: zalek | last post by:
I am writing application with Ajax in sync mode - xmlHttp.open("GET", url, false). I noticed that in FireFox handler doesn't starts. It starts when I use xmlHttp.open("GET", url,true). I need to use it in sync mode. Any ideas what can I do? Thanks, Zalek.
3
3508
by: sarika | last post by:
Hi all I m making a website in which i have used ajax technology . When i make a page request throght ajax it works fine in IE but giving problems in Mozilla .In mozila i m getting 403 status code with"Error 403 "Access Denied/Forbidden"" . Though same script is working fine in mozilla when run through other server. Please reply asap.
7
4033
by: mike57 | last post by:
The minimal AJAX script below works in Firefox, but not in IE, Opera, or Chrome. I could use some suggestions or referrals to resources that will help me get the script working in other browsers. Before there are six characters entered in the CAPTCHA code field, the 'Send' button is supposed to be disabled. When there are at least six characters in the CAPTCHA code field, the script attempts to verify the CAPTCHA w/AJAX. If it verifies, it...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8802
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
8658
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
7405
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 projectplanning, coding, testing, and deploymentwithout 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...
0
5682
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
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1787
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.