Problem: I have 2 related SharePoint lists: 1) Question and a Child (linked) list 2)Comment. I need to perform an JS call using jQuery to retrieve a specific comment item and I need to also know the Title field from it's related parent list (Question). The 2 lists are shown below. The post Creating related lists for SP Hosted Apps using VS2012 show you how to do this.
Resolution:
Open you browser and check the query works:
http://dev-d8f436fea03755.apps.dev.local/SPHostedApp/_api/web/lists/getByTitle('Comment')/items(1)?$select=*,Question/Title&$expand=Question/Title
(replace the url)
jQuery Ajax code I used to call the REST API is shown below:
The ajax call is made in the document.Ready() method call.
Resolution:
Open you browser and check the query works:
http://dev-d8f436fea03755.apps.dev.local/SPHostedApp/_api/web/lists/getByTitle('Comment')/items(1)?$select=*,Question/Title&$expand=Question/Title
(replace the url)
jQuery Ajax code I used to call the REST API is shown below:
The ajax call is made in the document.Ready() method call.
0 comments:
Post a Comment