Jump to content

[SOLVED] Big problem.


xyn

Recommended Posts

Ok guys, ive posted here but i really dont know where to post this.

 

Basically I am running an ajax script to save user preferences.

 

Internet explorer 6, on windows XP, SP2. it works.

Internet explorer 7, on windows XP, SP2. it works.

Firefox, on windows XP, SP2. again it works.

 

However, IE 6, IE7 and FF on Vista, doesnt work.

 

I dont know if its vista, or if there are settings in vista,

maybe my ajax code is not compatable, (no javascript errors are returned in IE or FF)

is my php being returned the wrong values? or is my PHP code wrong...

 

The JS (AJAX START):

function requestXML(){
if(window.XMLHttpRequest){
var r =new XMLHttpRequest();
}else if(window.ActiveXObject){
var r =new ActiveXObject("Microsoft.XMLHTTP");
}return r;
}
var fp =requestXML();

 

the function i run:

function saveSettings(){
var date =new Date();
var pmSystem =((document.getElementById('PMSystem').checked)?'Y':'N');
var pmAllow =((document.getElementById('PMAllow').checked)?'Y':'N');
var pmNotify =((document.getElementById('PMNotify').checked)?'Y':'N');
var BadLangFilter =((document.getElementById('BadLang').checked)?'Y':'N');
fp.open('get','/inc/ajax/save_settings.php?t='+date.getTime());
fp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
fp.onreadystatechange =function(){
if(fp.readyState ==4 &&fp.status ==200){
collectSettings();
alert('Your account settings have been updated, and will take an immediate effect.');
}
};
fp.send(encodeURI('&pm_system='+pmSystem+'&pm_allow='+pmAllow+'&pm_notify='+pmNotify+'&bfilter='+BadLangFilter));
}

 

(forgot the php)

<?
require_once "../../inc/headers.inc.php";
if($_SESSION['sessionName']){
mysql_query("update `accounts_settings` set `pm_system` ='".(($_POST['pm_system'] =='Y')?'Y':'N')."', `pm_allow` ='".(($_POST['pm_allow'] =='Y')?'F':'A')."', `pm_notify` ='".(($_POST['pm_notify'] =='Y')?'Y':'N')."', `language_filter` ='".(($_POST['bfilter'] =='Y')?'Y':'N')."' where `user_id` ='{$_SESSION['userID']}'");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/109135-solved-big-problem/
Share on other sites

nope, i found out its the object.

 

My new object i just created is this..., however with this function, It doesnt work on XP or vista.

 

function GetHttpRequestObject(){
var new_request;
var A; //debug
if(window.XMLHttpRequest){
	new_request =new XMLHttpRequest();
	A ='yes_1';
}else if(window.ActiveXObject){
	try{
		new_request =new ActiveXObject("Msxml2.XMLHTTP");
		A ='yes_2';
	}
	catch(e){
		try{
			new_request =new ActiveXObject("Microsoft.XMLHTTP");
			A ='yes_3';
		}
		catch(e){
			new_request =null;
			A ='no_';
		}
	}
}
alert(A);
return new_request;
}

Link to comment
https://forums.phpfreaks.com/topic/109135-solved-big-problem/#findComment-559835
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.