Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1544 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Cross Browser Ajax

Thread title: Cross Browser Ajax
Closed Thread    
    Thread tools Search this thread Display Modes  
07-10-2008, 11:52 PM
#1
Seraskier is offline Seraskier
Status: I love this place
Join date: Jan 2007
Location: Charlotte
Expertise:
Software:
 
Posts: 542
iTrader: 0 / 0%
 

Seraskier is an unknown quantity at this point

Send a message via AIM to Seraskier Send a message via MSN to Seraskier

  Old  Cross Browser Ajax

http://www.revonal.com/revonal%203/register.html

It runs fine in IE7 but when i test it in Opera, Safari, and Firefox nothing happens.

I've tried many sections of code.
many more than posted
Code:
 if (typeof XMLHttpRequest != "undefined") {
        return new XMLHttpRequest();
    } else if (typeof ActiveXObject != "undefined") {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        throw new Error("XMLHttpRequest not supported");
    }
Code:
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
only when i use this does it only work in ie and no other browser.
Code:
function queryUsername(queryString) {
    var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	
	if(queryString.length <= 3)
	{ document.getElementById("response").innerHTML='Insufficient Characters'; }
	else
	{
		xmlHttp.open("GET","include/js/ajax/username.php?username="+queryString,true);
		xmlHttp.send(null);
	}
	
	xmlHttp.onReadyStateChange = function() {
		if(xmlHttp.ReadyState == 4 && xmlHttp.Status == 200) {
			document.getElementById("response").innerHTML=xmlHttp.ResponseText;
		}
	}
}
also with FF, my textboxes appear acouple pixels shorter than all other major browsers.

07-20-2008, 09:12 PM
#2
infinivert is offline infinivert
infinivert's Avatar
Status: Junior Member
Join date: Jul 2008
Location: Abilene TX
Expertise: Design, PHP, JS, HTML5, CSS3
Software:
 
Posts: 37
iTrader: 0 / 0%
 

infinivert is on a distinguished road

Send a message via AIM to infinivert

  Old

Man, you can spend all day trying to tweak your AJAX code to work with all browsers if you're writing it from scratch. I know. Been there / done that.

I highly recommend using a reputable javascript library (I use Prototype.js) that simplifies that mess down to just a few lines without having to worry about making it cross-browser compatible.

--Josh

08-29-2008, 02:27 AM
#3
versatiletech is offline versatiletech
Status: I'm new around here
Join date: Jan 2007
Location: Orlando, FL
Expertise:
Software:
 
Posts: 11
iTrader: 0 / 0%
 

versatiletech is on a distinguished road

Send a message via Yahoo to versatiletech

  Old

Embrace the following jQuery:

$(function() {
$.Ajax({
url: 'index.php?Ajax=1',
data: $('form').serialize(),
dataType: 'html',
success: function(data) {
alert(data);
}
})
});

Once you go jQuery, you never turn back.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed