WordPress asynchron GET for shortcodes

I’m currently working on my first WordPress plugin a I want to get JSON Data from a Webserver via a GET request. I already tried some code like this: http://stackoverflow.com/a/36780287/4460483 but it’s not what I’m looking for.

Also jquery tells me: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

So the problem is that the data somehow doesn’t load fast enough and the page can’t load. The reason is that you need to directly return a result for a shortcode, right? But I guess that takes too much time. So what is the best way to make GET requests without freezing the thread building the page (in PHP)? Is there somehow Events to do something like that?

Read more here: WordPress asynchron GET for shortcodes

Leave a Reply

Your email address will not be published. Required fields are marked *