Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

post parameter only work in IE

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

post parameter only work in IE

Postby ynl » Sun Dec 16, 2012 6:42 pm

I use onreadystatechange function in a php form to update a dropdown control, proper function and when I submit, however when I use a browser other than IE (eg chrome, firefox) then the variable parameters are not sent when submitted.

my code
<select id="remarksrequeststatus" name="remarksrequeststatus" onChange="getState(this.value)" >

.
.
.
function createRequestObject() {
if (window.XMLHttpRequest) {
var xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType)
xmlhttp.overrideMimeType('text/xml');
}
else if (window.ActiveXObject) { // IE
try {
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) { }
}
}

if (!xmlhttp) {
alert('Giving up Cannot create an XMLHTTP instance');
return false;
}
return xmlhttp;
}

function getState(status) {

var strURL = "requeststatus.php?statusrs=" + status + "";

//var req = getXMLHTTP();
var req = createRequestObject();
if (!req) {
// Complain early, instead of nesting deeply
alert('Unable to set up the XHR object.');
return;
}

req.onreadystatechange = function () {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('requeststatusdiv').innerHTML = req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
};
req.open("GET", strURL, true);
req.send(null);
}
ynl
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Dec 16, 2012 6:36 pm

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron