This project has moved and is read-only. For the latest updates, please go here.

Possible to update specific areas of an existing SP 2013 site page with SPServices GetListItemsJson?

Dec 8, 2014 at 11:39 PM
Edited Dec 8, 2014 at 11:40 PM
I'm struggling with how to update existing html coding with the data from SPServices and was wondering if there was a way to do this through some kind of placeholder and maybe an append or find and replace function. Unforunately, I've searched the web and this site and can't seem to find anything on point. Most of the examples I've seen are creating a table from scratch or updating a list.

By way of example, the page I'm trying to create would look something like the following:


SUBJECT: Subject text


I'd like to update the Title, Subtitle, & Subject Text with data retrieved from a list within the same site. Except for the Title & Subtitle, all of the rest of the information, such as Subject text, is in an existing table. I'd would greatly appreciate any help. Thanks in advance.
Dec 9, 2014 at 4:41 AM
Edited Dec 9, 2014 at 4:41 AM
You won't find an example showing exactly what you want to do because your needs are very specific.

What you'll need to do is figure out what selector will get you to the right section of HTML in the DOM so that you can insert your values.

The selector might be something like (purely conceptual!):
$(".article:eq(" + i ")")
where i means the ith element in the page with the article CSS class applied to it.

Then you'd traverse the DOM to insert your values...
$(".article:eq(" + i ")").find("div[title='Title']")
and insert your text:
$(".article:eq(" + i ")").find("div[title='Title']").html(newTitle);
Dec 9, 2014 at 9:05 AM
Edited Dec 12, 2014 at 5:09 AM
Resolved by adding ids to the td sections I wanted to complete using SPServices and using something like the following:


Thanks for your help.
Marked as answer by awschneider on 12/11/2014 at 9:09 PM