0

I am making an ajax "GET" request to get google wikipedia data in my application. I want to get the progress in numbers to feed it to my loading progress bar. Is there any way to do this for "GET" request? All the solutions available are either for upload or "POST".

THis is my request code

let params = {
  'query': this.state.info_search_text,
  'limit': 10,
  'indent': false,
  'types': 'Person',
  'prefix': true,
  'key': 'AIzaSyDuttGdbTLwBlVWunqGPdgUrb1c2gXwPYk'
};

$.getJSON(service_url + '?callback=?', params, (response) => {
    this.setState({
        infoSearchResults: response.itemListElement,
        showLoadingBar: false
      }, () => {
       console.log(this.state.showLoadingBar)
      });
});
Joe Warner
  • 3,335
  • 1
  • 14
  • 41
EdG
  • 2,243
  • 6
  • 48
  • 103
  • "$.getJSON(service_url + '?callback=?'" — It isn't possible with JSONP. You need to use XHR or Fetch. – Quentin Mar 12 '18 at 13:39
  • @Quentin true....i did not know this. But how can this work without using websockets? – messerbill Mar 12 '18 at 13:39
  • 1
    @messerbill — See the duplicate question – Quentin Mar 12 '18 at 13:40
  • @Quentin this is quite awesome. - so the client will request and once the server started to respond the progress handler waits for new incoming "data parts"? – messerbill Mar 12 '18 at 13:42
  • I can't flag this as a duplicate, but here is the link to an answer that already has it done for you: [https://stackoverflow.com/questions/19126994/what-is-the-cleanest-way-to-get-the-progress-of-jquery-ajax-request](https://stackoverflow.com/questions/19126994/what-is-the-cleanest-way-to-get-the-progress-of-jquery-ajax-request) – th3n3wguy Mar 12 '18 at 13:36

0 Answers0