-
-
Save mihdan/6e466e701e4fe7f3daa30f102e45d0dd 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