Which code segment should you use?

You are developing an HTML5 web application that displays customer mailing address information.
The application loads addresses from a web service by using AJAX.
The following code defines a Customer object and loads address data.

You need to implement the loadAddress function. Which code segment should you use?

You are developing an HTML5 web application that displays customer mailing address information.
The application loads addresses from a web service by using AJAX.
The following code defines a Customer object and loads address data.

You need to implement the loadAddress function. Which code segment should you use?

A.
$.get(‘data.xml’, function (data) {
(function (scope) {
scope.parseAddress(data);
})(data);
});

B.
$.get(‘data.xml’, function (data, innerScope) {
innerScope.parseAddress(data);
});

C.
var that = this;
$.get(‘data.xml’, function (data) {
that.parseAddress(data);
}

D.
$.get(‘data.xml’, function (data) {
this.parseAddress(data);
}



Leave a Reply 0

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