How should you complete the relevant code?

DRAG DROP
You develop an HTML application that calls a web service to retrieve JSON data. The web
service contains one method named GetFullName that returns an Object named data. The
data object contains two properties named GivenName and Surname.
You need to load data from the web service to the webpage.
How should you complete the relevant code? (To answer, drag the appropriate code
segment or code segments to the correct location or locations in the answer area. Use only
code segments that apply.)

DRAG DROP
You develop an HTML application that calls a web service to retrieve JSON data. The web
service contains one method named GetFullName that returns an Object named data. The
data object contains two properties named GivenName and Surname.
You need to load data from the web service to the webpage.
How should you complete the relevant code? (To answer, drag the appropriate code
segment or code segments to the correct location or locations in the answer area. Use only
code segments that apply.)

Answer:

Explanation:



Leave a Reply 11

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


anthony

anthony

the answer is only res, not res.data

Alex

Alex

Are you sure about that? (not sarcastic, I really want to know)

noobs

noobs

agree with anthony, it should only res

BarryC

BarryC

Hmmm, I’m not too sure about that. In the question it states ‘The web
service contains one method named GetFullName that returns an Object named data. The
data object contains two properties named GivenName and Surname.’. I would think that res contains an object named data that has two properties, GivenName and Surname.

Aires

Aires

I don’t think the answer is correct, the said “Display loan amounts in order starting with the greatest amount and ending with the least amount” this means the first function should have the value 1000; the second function 800; and the third one 400.

Raaph

Raaph

You are wrong. It is actually correct since the first alert called is in the showAnotherLoanAmount() function where the var loanAmount is 1000.

grt

grt

The object we are passing to the function in Success: Function(obj); is the data.

So, in this case res itself is the data object no need to call res.data

Iqbal chaudhary

Iqbal chaudhary

This is correct answer. I have executed it.
ShowLoadAmount();
function ShowLoadAmount(){
var loanAmount = 400;
function showSomeLoanAmount(){
showAnotherLoanAmount();
function showAnotherLoanAmount(){
var loanAmount = 1000;
alert(loanAmount);
}
var loanAmount = 800;
alert(loanAmount);
}
showSomeLoanAmount();
alert(loanAmount);
}

Would You Agree?

Would You Agree?

I think there is another answer:

showLoanAmounts();
function showLoanAmounts(){
var loanAmount = 400;
function showSomeLoanAmount(){
showAnotherLoanAmount();
function showAnotherLoanAmount(){
var loanAmount = 1000;
alert(loanAmount);
}
var loanAmount = 800;
alert(loanAmount);
}
showSomeLoanAmount();
alert(loanAmount);
}

brkyctn

brkyctn

You can access object properties in two ways:
objectName.propertyName
or
objectName[propertyName]
Reference: JavaScript Objects