I am using SharePoint 2013 Rest API and I have successfully used $expand but I'm having a hard time referencing what I have expanded. Here's what I see in developer tool: enter image description here

This does not work - data.d.resutlts[0].AssistantChief.EMail

var projNum = '402-I-001';

var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbyTitle('Project Module')/items?$select=AssistantChief/EMail,&$expand=AssistantChief/Id";

    url: endPointUrl, 
    type: "GET", 
    headers: { "Accept": "application/json; odata=verbose" }, 
    success: function (data) {
        detailComplete(data); // Returns JSON collection of the results
    error: function (err) { 
        alert("Error Occured:" + JSON.stringify(err)); 

  • is that jQuery selector code within the detailComplete() function? – Michael Colbs Jul 13 '17 at 15:34

We can see that the Ajax request is working correctly. So, there is no issue fetching data from the list as we can see the data logged in console.

The issue is when you are trying to bind that data to html because of a typo in your code.

It should be results and not resutlts.

Replace, data.d.resutlts[0].AssistantChief.EMail with data.d.results[0].AssistantChief.EMail.

So, your html would be:

| improve this answer | |
  • 1
    Oh my! Good catch. That fixed the problem. Thanks! – JustMe Jul 13 '17 at 18:11

You have some syntax right off the hop with the first var. There is a typo in your last line. Also, try using deferred. I would need the list to confirm if the result set returns the property you are referencing, but hopefully this helps

var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbyTitle('Project Module')/items?$select=AssistantChief/EMail,&$expand=AssistantChief/Id"

getData(sRestApiRequestUrl ).then(function (spData) {

function getData(query) {

var deferred = $.Deferred();
    url: query,
    type: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (results) {
    error: function (jqXHR, textStatus, errorThrown) {

  return deferred.promise();

function detailComplete(spData) {
    var chief = spData.d.AssistantChief.Email;
| improve this answer | |

In your case you need to perform append operation inside ajax success method success: function (data) { } or inside detailComplete() function. Dont chain .html() at the end of .append() as .html() again will return entire html of the selector

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.