Closed f1uk3r closed 3 years ago
Hi @f1uk3r,
Please have a look here: WPP with an AJAX-based site.
Sorry for late reply @cabrerahector
I don't think the link you send me is very relevant to my question. I apologise I didn't told you that I am using Vue.js for the frontend.
But your link led me to another one of your answers and I tried using blog.example.com/wp-json/wordpress-popular-posts/v1/popular-posts?wpp_id=463
to register the count, but it is still not happening. I am just receiving an empty Array/List. What am I doing wrong here?
Hey @f1uk3r,
I don't think the link you send me is very relevant to my question. I apologise I didn't told you that I am using Vue.js for the frontend.
Vue is just another JavaScript framework. The solution still applies in your case: you need to send a POST
request to the mentioned REST API endpoint with the parameters as described on the link I shared above. Use either the XMLHttpRequest object or Axios to do so.
What am I doing wrong here?
I'm not familiar enough with Vue.js to be able to help with actual code, but:
POST
request (from your comments above it seems to me that you sent a GET
request instead),wpp_id
parameter),Make sure you're sending a POST request (from your comments above it seems to me that you sent a GET request instead)
I don't know how I can be this stupid. I was pretty sure I usedPOST
request, but I guess I didn't. Thanks anyways.
I am using WordPress API as a backend to my blog app. I hit
www.mywebsitename.com/blog/{someId}
to get the content of an article, but it doesn't trigger the count in this plugin. Is there a way I can trigger the count when I hit WP API?