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.)
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.)
There are actually two correct answers to this. The one posted and also:
var loanAmount = 400;
snowAnotherLoanAmount();
var loanAmount = 1000;
var loanAmount = 800;
https://jsfiddle.net/tavo2mzb/
Why on earth res.data? In normal cases only displays data in function argument so you should print data.data? No.
What is the correct answer
O DAMN the object we recieve is called data
http://www.w3schools.com/json/json_syntax.asp
The correct 1st code block should be “res”, not “res.data”.
Even in ASMX webservice world and we wanted to get pedantic, the response payload would be placed inside a “d” property of res (so “res.d” would be acceptable). However nowhere should we make the assumption that invoking an as-described “web service” would return its payload in a “data” property.
WRONG ANSWER. WRONG ANSWER!!!!!!!!!!!!!!!!