seanybravo
IS-IT--Management
I have come across this piece of code:
try {
// Moz supports XMLHttpRequest. IE uses ActiveX.
// browser detction is bad. object detection works for any browser
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
// browser doesn't support ajax. handle however you want
}
is the : a shortcut to try differient bits of code because I would like to put in another line in. It looks like it tries two lines of code to me. I have tested it and it works but falls over when I add an extra line:
try {
objXmlHttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP"):
new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
alert ("Cant start XMLHTTPRequest!")
}
Any feedback would be great.
try {
// Moz supports XMLHttpRequest. IE uses ActiveX.
// browser detction is bad. object detection works for any browser
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
// browser doesn't support ajax. handle however you want
}
is the : a shortcut to try differient bits of code because I would like to put in another line in. It looks like it tries two lines of code to me. I have tested it and it works but falls over when I add an extra line:
try {
objXmlHttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP"):
new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
alert ("Cant start XMLHTTPRequest!")
}
Any feedback would be great.