From 03d64863c8e75b9a4da9845dfb210be1847c5202 Mon Sep 17 00:00:00 2001 From: BehindTheMath <9314934+BehindTheMath@users.noreply.github.com> Date: Mon, 23 Jul 2018 20:46:13 -0400 Subject: [PATCH] Fix README. Also pass the current options object to loadContent() (#171) Fixes #167 --- README.md | 7 ++++--- index.js | 1 + lib/proto/handle-response.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c056a03..59a1512 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ pjax.loadUrl("/your-url") pjax.loadUrl("/your-other-url", {timeout: 10}) ``` -#### `handleResponse(responseText, request, href)` +#### `handleResponse(responseText, request, href, options)` This method takes the raw response, processes the URL, then calls `pjax.loadContent()` to actually load it into the DOM. @@ -181,6 +181,7 @@ It is passed the following arguments: * **responseText** (string): This is the raw response text. This is equivalent to `request.responseText`. * **request** (XMLHttpRequest): This is the XHR object. * **href** (string): This is the URL that was passed to `loadUrl()`. +* **options** (object): This is an object with the options for this request. The structure basically matches the regular options object, with a few extra internal properties. You can override this if you want to process the data before, or instead of, it being loaded into the DOM. @@ -191,9 +192,9 @@ var pjax = new Pjax(); pjax._handleResponse = pjax.handleResponse; -pjax.handleResponse = function(responseText, request, href) { +pjax.handleResponse = function(responseText, request, href, options) { if (request.responseText.match("