Hi everyone.
I am using the Ajax tutorial from ajaxfreaks, here is the JS:
Code:
<script type="application/javascript" language="javascript">
function createRequestObject() {
var req;
if(window.XMLHttpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// There is an error creating the object,
// just as an old browser is being used.
alert('Problem creating the XMLHttpRequest object');
}
return req;
}
// Make the XMLHttpRequest object
var http = createRequestObject();
function sendRequest(act) {
// Open PHP script for requests
http.open('get', '_includes/_submit_airport.php?+act);
http.onreadystatechange = handleResponse;
http.send(null);
}
function handleResponse() {
if(http.readyState == 4 && http.status == 200){
// Text returned FROM the PHP script
var response = http.responseText;
if(response) {
// UPDATE ajaxTest content
document.getElementById("airportBox").innerHTML = response;
}
}
}
</script>
And this is how I am using it:
Code:
<input type="button" name="submit" id="submit" value="Add" onClick="sendRequest('name=' + airport.name.value + '&country=' + airport.country.value + '&state=' + airport.state.value + '&city=' + airport.city.value + '&icao=' + airport.icao.value);" />
So basically it sends some data which will eventually look like:
_submit_airport.php?name=x&country=x&state=x... etc.
Everything works flawlessly in Firefox, Opera, and Safari, but not in IE7 (haven't tried IE6 yet). All it says is that there is an error on the line of the second code I posted, Character 1, and the error is "Object Expected".
Any ideas?
Thanks