I’m working with an API (DocumentCloud) using jQuery/JSON. I’m trying to retrieve a specific page of text, which the API almost provides.
The returned JSON contains an object called resources.page which offers the following:
text: "http://www.documentcloud.org/documents/293026/pages/ohio-higher-education-capital-funding-p{page}.txt"
The confusing part is the end: p{page}.txt
Is it possible to specify a page in place of {page} and return the content? (If I use “5” instead of {page} and put it into the browser, I see the text I’m looking for.)
Sure, you can use string.replace
Test it here: http://jsfiddle.net/dy22q/
..fredrik