Ajax not working in Mozilla firefox


I have tested following code and it works fine in IE but not Mozilla: var ajax = false; if (window.XMLHttpRequest) {
ajax = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) { try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2) {}
}
} if (!ajax) {
alert ('Some page functionality is unavailable.');
} Please tell me what is the solution
Posted On: Monday 26th of November 2012 11:12:15 PM Total Views:  332
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Help with simple ajax

what am i doing wrong, it does not echo "hello"......ths page is unt.php Untitled Document var ht=false; if(navigator.appName=="Microsoft Internet Explorer") { ht=new ActivxObject("Microsoft.XMLHTTP"); } else { ht=new XMLHttpRequest(); } function chkLogin() { if(ht!=null) { document.getElementById('error').innerHTML="Loading plz wait...."; var idd=document.getElementById('uid').value; var psw=document.getElementById('pass').value; ht.open("GET","unt.phpid="+idd,true); ht.onreadystatechange=function(){ if(ht.readyState==4){ alert('yeah'); } } http.send(null); } else { alert('Nahi support'); } }
VIEWS ON THIS POST

276

Posted on:

Sunday 25th November 2012
View Replies!

Looking for code in ajax for dropdownlist date.

I need to build an ajax dropdownlist date selector. Can someone help me.
VIEWS ON THIS POST

175

Posted on:

Sunday 25th November 2012
View Replies!

Send input value with ajax

, Im very new to Ajax. I have a form with 2 input values , name and date. I have in the same page 3 links to select images, fonts and colours. When an image is selected, the child page closes and the parent page refreshes. Then i can see the image i have chosen. Now the values filled in in the name and date input values are gone and people have to re-enter them. I know its possible that if a use fills in the name, it can send the value instantly to an php server, there i want to save it as a session so it will the echoed into the input value. Does anyone know How to do this
VIEWS ON THIS POST

168

Posted on:

Sunday 25th November 2012
View Replies!

ajax won't work without the www in url

at url http://lowellbonnell.ca/index.phpview=Markets my ajax will only work if you insert the www in firefox. IE is fine either way. Any ideas, Yep you are right. That is a little quirk in the Mozilla XMLHTTP object. You should really be using some kind of library to perform your asynchronous javascript calls. JQUERY makes it super easy and is compatible with all broswers. http://jquery.com/ jenni
VIEWS ON THIS POST

128

Posted on:

Sunday 25th November 2012
View Replies!

Can't change div after ajax

!! I've had this problem once before and I fixed it at that time by changing the way I was calling the pages from AJAX to straight PHP headers but now I'm annoyed and I don't want to put a quick fix on it. That being said, here is the problem I'm having... I'm using AJAX to load the contents of a page in to one of my div's -- works great. After I load the content in to the div, I have a js function to show/hide the contents of the different internal div's. That doesn't work and if I view the source of the page, it still shows the source from when the page loaded. A lot of google results returned jQuery solutions but I'm thinking there has to be something I'm missing here --- Below is my code if it helps but I'm just looking for some feedback or a proverbial slap in the head to knock me straight on this Original Page Source Javascript function to populate that div if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById("int_body").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET",loadPage, true); xmlhttp.send(); What I'm loading the div with About Me Edit Hide Then for extra measure, this is the function I'm trying to run after the fact that isn't working -- and I know it works because when I load the page from PHP as a page, it works fine function ShowHideDiv(CurDiv, CurImg){ CurDiv = CurDiv + "_int"; if ( document.getElementById(CurDiv).style.display == "block" ){ document.getElementById(CurDiv).style.display = "none"; }else{ document.getElementById(CurDiv).style.display = "block"; } ChangeAddCloseImg(CurImg); } As always, thanks in advance!!!! This post has been edited by guyfromri: 28 April 2012 - 01:09 PM
VIEWS ON THIS POST

162

Posted on:

Monday 26th November 2012
View Replies!

parsing array object from php : ajax

dear all, i ask your help.. i've script in php: $conn=koneksiDB(); $conn->StartTrans(); $conn->SetFetchMode(ADODB_FETCH_ASSOC); ...... $hasil = array('kdprop' => $row[kdprop],'kdkab' => $row[kdkab], 'kdkec' => $row[kdkec], 'flag' => $row[flag]); .......... return $hasil; and in javascrpit: function awal_stkuh() { var kdprop=$("#kdprop").val(); var kdkab=$("#kdkab").val(); ............... $.ajax({ type: "POST", url: "./actions/stkuh_r.php", data:'kdprop=' + kdprop+ '&kdkab='+kdkab+ ............. success:function(data) { $("#b1r4").val()=data.b1r4; } }); } i want to place values in array object to variable in javascript... what should i do with 'success:function(data)'
VIEWS ON THIS POST

169

Posted on:

Monday 26th November 2012
View Replies!

Trouble with ajax jquery validation submital radio buttons

I was making a survey and it was working fine with the jquery validate I was getting the right variables but when I added the ajax submit function now i only get the first radio as the value. What kind of beer did you have this weekend Domestic Import Craftbeer or Microbrew Cheapest I could find of the above ajax function $(document).ready(function(){ $("form#commentForm").submit(function() { // we want to store the values from the form input box, then send via ajax below var beerKind = $('#beerKind').attr('value'); var beerPlace = $('#beerPlace').attr('value'); var beerType = $('#beerType').attr('value'); var state = $('#state').attr('value'); var sex = $('#sex').attr('value'); $.ajax({ type: "POST", url: "actionSurvey.php", data: "beerKind="+ beerKind +"& beerPlace="+ beerPlace +"& beerType="+ beerType +"& state="+ state +"& sex="+ sex, success: function(){ $('form#commentForm').hide(function(){$('div.success').fadeIn();}); } }); return false; }); }); any help greatly appreciated
VIEWS ON THIS POST

185

Posted on:

Monday 26th November 2012
View Replies!

how the add on load image in ajax

Are you trying to ask a question Can you elaborate on what you are trying to accomplish
VIEWS ON THIS POST

151

Posted on:

Monday 26th November 2012
View Replies!

javascript or ajax which one?

hello :-)i want to have your opinion.im going to design a site for a car showroom .which includes a search form,the problem im facing is that there are two combo box one for the make and one for the model.so when the user selects the make the model combo box will load the related models. suppose if i choose ford ,in the combo box below the models Mustang,focus will be loaded and once the user clicks the search button the result will be displayed I was told to use ajax but i have no clue of AJAX at all,is there any way to make it happen by using only javascript ,php and sql to have the combo box working This post has been edited by deathmeat: 03 March 2011 - 12:56 PM
VIEWS ON THIS POST

191

Posted on:

Monday 26th November 2012
View Replies!

javascript or ajax which one?

hello :-)i want to have your opinion.im going to design a site for a car showroom .which includes a search form,the problem im facing is that there are two combo box one for the make and one for the model.so when the user selects the make the model combo box will load the related models. suppose if i choose ford ,in the combo box below the models Mustang,focus will be loaded and once the user clicks the search button the result will be displayed I was told to use ajax but i have no clue of AJAX at all,is there any way to make it happen by using only javascript ,php and sql to have the combo box working This post has been edited by deathmeat: 03 March 2011 - 12:56 PM
VIEWS ON THIS POST

175

Posted on:

Monday 26th November 2012
View Replies!

calling multiple ajax function on single onchange()

Actually i made two ajax function on single onchange() but when i fetch value on next page it will generate null pointer exception .The code is here........... function disease_desc(id,type,desc) { alert(id); alert(type); alert(desc); var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { //alert(xmlHttp.responseText); document.getElementById("b").innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET","Drug_Interaction_Panel_Ajax.jspid="+id+"&type="+type+"&desc="+desc,true); xmlHttp.send(null); } function disease_drug(id,type,value) { alert(id); alert(type); alert(value); var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { //alert(xmlHttp.responseText); document.getElementById("d").innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET","Drug_Interaction_Panel_Ajax.jspid="+id+"&type="+type+"&value="+value,true); xmlHttp.send(null); } Now the function calling......... MOD EDIT: When posting code...USE CODE TAGS!!! This post has been edited by JackOfTrades: 13 September 2010 - 12:50 PM
VIEWS ON THIS POST

288

Posted on:

Monday 26th November 2012
View Replies!

xmlResponse is null for ajax query in firefox / chrome

user types text in a text box, the text is sent to a php script with ajax. The response is used to populate a select menu. I am getting a xmlResponse is null error with some browsers. Steps to recreate problem: 1. Goto Example page , in firefox/chrome. 2. type 's' in the text box 3. a menu should pop up, but instead I get xmlresponse is null (in firebug) . The exact thing works on localhost on firefox/chrome but not when hosted. In Opera it works when hosted on localhost / internet. Why The xmlResponse -(copied from firebug) Sarvpriya Vihar2Sarvodaya Enclave6 The Code - function handleKeyDownevent (e) { mapimage.style.display = 'none' ; e = e || window.event ; if (xmlHttp) { // try { //xmlHttp.open('GET' , 'async.txt', true ) ; var target= e.target || e.srcElement ; var typed = target.value ; if (typed != ""){ ////console.log('sennding request') ; xmlHttp.open('GET' , 'http://kutchbhi.x10.mx/ajax/choose.phpname='+typed, true ) ; xmlHttp.onreadystatechange = handleServerResponse ; xmlHttp.send(null) ; } else { selectOption.innerHTML = "" ; ////console.log(e.srcElement.value + "is blank") ; } // } // catch(e) { // //console.log('could not connect to server') ; // } } else { ////console.log('error') ; } } function handleServerResponse() { if (xmlHttp.readyState == 4 ) { if ( xmlHttp.status == 200) { // try { var xmlResponse = xmlHttp.responseXML ; var rootNode = xmlResponse.documentElement ;
VIEWS ON THIS POST

209

Posted on:

Monday 26th November 2012
View Replies!

not sure if ajax isnt sending or is the php code i?

When i click a button
VIEWS ON THIS POST

159

Posted on:

Monday 26th November 2012
View Replies!

ajax and lightbox

hello, A site I am developing uses innerhtml to load all content into a content box. I have the jquery script links and function on the main part of the page that does not refresh. The image gallery is printed into the content box when the innerhtml function is called but fancybox does not function then. I have tested my code by building a static site with no ajax call, and then the fancybox functions exactly as deed. but when i use php and innerhtml to write the image gallery links onto the page it will not function. What is going on here is the code: in the header of the static part of the page, which does not reload on the ajax call: The innerhtml function spits out this into the content area (note that all quotes are escaped due to php - that explains all the extra slashes): Image gallery (ps, try using mouse scroll wheel) I cant get it right. I am thinking that maybe the function needs to be refreshed too, but I am not certain exactly how to make that happen.
VIEWS ON THIS POST

161

Posted on:

Monday 26th November 2012
View Replies!

Update database with ajax and with different input?

I am trying to write a script that will update my database(s) without the user having to click any buttons. I also want the update to occur whenever a field is modified in the form. So here is an example form currentvalfromdb 1 ... currentvalfromdb Now whenever a user changes a value on any one of the fields, the field is updated in the DB and a confirmation is printed below the field saying "Data Updated" or something to that effect. Now using ajax I've been able to update a single field. But the script I'm using assigns the updated value to the same variable every time (in this case it's 'q'). the javascript looks like this (I found this on the web all over the place) var xmlHttp; function updateDB(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="scripts/ajaxProcess.php"; url=url+"q="+str; //url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } I see why the variable 'q' ends up being what is passed to the db update script. What I need is for this variable to be dynamic, that is to say, that the variable name changes per field. I 'could' just assign a var for each variable in the script, but problem a: there are 6 different tables involved in this update and problem b: there are almost 50 fields to work with and they may change from time to time; I don't what to have to do extra work if I don't have to. Is there a way to write the script so that it will dynamically figure out the field name (I will use the database field name as the form field name, to keep it simple) and assign THAT field name to the $_GET's name A bit more simple, but I would also include the table name in the field name (so something like table|fieldname as the field name) so when the variable is sent to be processed, it'll know which table to query, which field, and what the new value is. I suppose I'll also have to send the old value (or the id for the row of that table being updated) so it may need to be something like "table|row|fieldname" If I can get assistance with the first part (dynamic variable name), I can figure out the second half pretty easily.
VIEWS ON THIS POST

115

Posted on:

Monday 26th November 2012
View Replies!

Get websites sourcecode with ajax?

Is it possible to get a websites source code using ajax
VIEWS ON THIS POST

175

Posted on:

Monday 26th November 2012
View Replies!

ajax form not finding javascript function

Hi! I can't seem to figure out what I'm doing wrong with this no matter how many things I try. I've looked through Google for a related issue but found nothing specific. Hopefully someone can help me. The script runs through a external .js file calling a list of music albums, then listing the song of the album chosen via ajax. The user can then edit of delete the songs. Everything works fine until I submit the edited information through a form. When I click the submit button I get a web developer error "updateSong is not a function" Here's the form which is loaded into the already existing page via ajax:
VIEWS ON THIS POST

160

Posted on:

Monday 26th November 2012
View Replies!

ajax+php+mysql

, I'm trying to use Ajax to update a field from a mysql table, but I cannot find a way to make it work (I really don't know too much about ajax) I have this right now. Ajax code function delete(){ xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="discon.php"; xmlhttp.open("POST",url,true); xmlhttp.send(null); } And this. php code
VIEWS ON THIS POST

175

Posted on:

Monday 26th November 2012
View Replies!

passing javascript array to ajax

HI, can we pass a java script array as an argument to php using ajax request. i am trying the following code but it's not working. can any one help me pls.. java script function showCalendar() { var arr=new Array(1,2,3,4,5); alert(arr.length); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null){ alert ("Browser does not support AJAX - Please update"); return; } var url="getArray.php"; url=url+"arr="+arr; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("show").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject(){ var xmlHttp=null; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e){ //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } php code i want to catch the array from java script. Then i want to do some stuff with array and again i want to return back that array to java script. is it possible.
VIEWS ON THIS POST

170

Posted on:

Monday 26th November 2012
View Replies!

php mysql ajax populate multiple textbox

Dear ajax expert, http://www.w3schools.com/php/php_ajax_php.asp Refer to the link, using the sample, I'm able to use php ajax to populate 1 text box which I've already pre-define (not using "echo '
VIEWS ON THIS POST

187

Posted on:

Monday 26th November 2012
View Replies!