Created
April 10, 2017 16:49
-
-
Save mgibbs189/59a0a050e9bd1ba0aedadb2e8c565cc5 to your computer and use it in GitHub Desktop.
FacetWP - REST API - ajax example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function($) { | |
$(function() { | |
var data = { | |
'facets': { | |
'make': ['audi'], | |
'vehicle_type': [] | |
}, | |
'query_args': { | |
'post_type': 'cars', | |
'posts_per_page': 4, | |
'paged': 1 | |
}, | |
}; | |
$.ajax({ | |
type: 'POST', | |
url: 'http://wp.dev/wp-json/facetwp/v1/fetch', | |
data: { data: JSON.stringify(data) }, | |
success: function(response) { | |
console.log(response); | |
} | |
}); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment