J
Jochem Donkers
Hi,
So far I wrote a few little things in javascript, but I got a small
problem with the following code. Apperently, only Apple's Safari is
handling the following code correctly. I took it from a webpage, and
modified it a bit (just the request line). I might have made some basic
mistake there.
My questions is especially concerning th following piece of code. There
seems to be a problem in the line with http.open(). At least if I put
an alert() message before it it pops-up, after it it does not show.
function getPriority2(code){
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
Is there anybody who has an idea about how make it working in all
browsers? Below you find my whole javascript code. It refers to a php
page (from which I know it is working correctly - got a lot more
experience there than with javascript).
I would highly appriciate any help!
Thanks in advance!!!!
Regards,
Jochem
------------------
My code
------------------
function createRequestObject(){
var request_o; //declare the variable to hold the object.
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_o = new XMLHttpRequest();
}
return request_o; //return the object
}
var http = createRequestObject();
function getPriority1(code){
http.open('get', 'appointment_support.php?code='+ code );
http.onreadystatechange = handlePriority1;
http.send(null);
}
function handlePriority1(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// UNTIL HERE IT SEEMS TO BE WORKING FINE!!!!
// Get priority 2
function getPriority2(code){
// alert('shit');
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority2(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// Get priority 3
function getPriority3(code){
http.open('get', 'appointment_support.php?level=3&code='+ code
+'&idone='+ document.registration.priority1.value +'&idtwo='+
document.registration.priority2.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority3(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
So far I wrote a few little things in javascript, but I got a small
problem with the following code. Apperently, only Apple's Safari is
handling the following code correctly. I took it from a webpage, and
modified it a bit (just the request line). I might have made some basic
mistake there.
My questions is especially concerning th following piece of code. There
seems to be a problem in the line with http.open(). At least if I put
an alert() message before it it pops-up, after it it does not show.
function getPriority2(code){
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
Is there anybody who has an idea about how make it working in all
browsers? Below you find my whole javascript code. It refers to a php
page (from which I know it is working correctly - got a lot more
experience there than with javascript).
I would highly appriciate any help!
Thanks in advance!!!!
Regards,
Jochem
------------------
My code
------------------
function createRequestObject(){
var request_o; //declare the variable to hold the object.
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_o = new XMLHttpRequest();
}
return request_o; //return the object
}
var http = createRequestObject();
function getPriority1(code){
http.open('get', 'appointment_support.php?code='+ code );
http.onreadystatechange = handlePriority1;
http.send(null);
}
function handlePriority1(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// UNTIL HERE IT SEEMS TO BE WORKING FINE!!!!
// Get priority 2
function getPriority2(code){
// alert('shit');
http.open('get', 'appointment_support.php?level=2&code='+ code
+'&idone='+ document.registration.priority1.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority2(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}
// Get priority 3
function getPriority3(code){
http.open('get', 'appointment_support.php?level=3&code='+ code
+'&idone='+ document.registration.priority1.value +'&idtwo='+
document.registration.priority2.value );
http.onreadystatechange = handlePriority2;
http.send(null);
}
function handlePriority3(){
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('priorities').innerHTML = response;
}
}