I have an AJAX call querying the SharePoint REST API which will return more than 500 rows:
$.ajax(
{
url: _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='Department:"
+ "*'&selectproperties='Department'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&sortlist='Department:ascending'&rowlimit=500",
method: "GET",
headers: {
"accept": "application/xml",
},
success: onSuccess,
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
}
);
The REST API has a 500 row limit, so I cannot increase the rowlimit
variable in the url
.
In my onSuccess function, I'm trying to read the total rows to see if I need to query again for more rows:
onSuccess = function (data) {
var rows = data.d.postquery.PrimaryQueryResult.RelevantResults.TotalRows;
....
This throws an exception that postquery
does not exist, however.
How can I grab the TotalRows and query the REST API for additional rows?