Page 1 of 1

[SOLVED] How to limit results in the ajax call?

Posted: Sat Aug 02, 2014 6:00 am
by kulve
Hi,

Odd, only one topic in data.sparkfun.com..

Here's the second one. How do I limit the number of results?

In the example here: http://phant.io/docs/output/http/

The data is limited to one page but where is the meaning of a "page" documented? How many results does it contain? How do I know how many pages there are? How can I get just the latest value and not a whole page?

I haven't worked much with javascript before so if that's some standard jQuery-API, a pointer to its documentation would be appreciated.

Thanks.

Re: How to limit results in the ajax call?

Posted: Mon Aug 04, 2014 5:03 am
by kulve
A "page" is a chunk in Phant's storage terms. It seems to default to 500k which is way too much if I need to query just for the latest value quite often.

The chunk can be defined on your own server by exporting PHANT_CHUNK.

I also had to append "?page=1" to the URL instead of using the syntax in the example.