Which code segment should you insert at line 03?

You deploy a Virtual Earth 6.0 application that uses Microsoft ASP.NET Asynchronous JavaScript and XML (AJAX) implementation to retrieve data.
The myAjaxCallback function evaluates any AJAX response. The function contains the following code segment. (Line numbers are included for reference only.)

01 function myAjaxCallback (){
02 if (xmlHttp.readyState == 4){
03 …
04 }
05 }

At the time the request was made, the server was overloaded. When the server processed the AJAX request, the server returned an error message.

You need to ensure that the application does not produce a fatal exception due to the error generated from the AJAX response.

Which code segment should you insert at line 03?

You deploy a Virtual Earth 6.0 application that uses Microsoft ASP.NET Asynchronous JavaScript and XML (AJAX) implementation to retrieve data.
The myAjaxCallback function evaluates any AJAX response. The function contains the following code segment. (Line numbers are included for reference only.)

01 function myAjaxCallback (){
02 if (xmlHttp.readyState == 4){
03 …
04 }
05 }

At the time the request was made, the server was overloaded. When the server processed the AJAX request, the server returned an error message.

You need to ensure that the application does not produce a fatal exception due to the error generated from the AJAX response.

Which code segment should you insert at line 03?

A.
If(xmlHttp.status == 200){ eval(xmlHttp.responseText); } else{ // Update user with status here. }

B.
try{ eval(xmlHttp.responseText); } catch(error){ // Update user with status here. }

C.
try{ eval(xmlHttp.responseText); } catch(error){ eval(xmlHttp.responseXML); }

D.
try{ eval(xmlHttp.responseText); } catch(error){ if(xmlHttp.status == 200){ eval(xmlHttp.responseText); } }



Leave a Reply 0

Your email address will not be published. Required fields are marked *