Important: Please read the Qt Code of Conduct -

How do I know the web page is ready after an ajax request?

  • I have a page opened in my QWebView which update its contents via ajax. I want to grab those HTML elements when updated but I don't know at what time I should do that. Because from what I've seen, loadFinished() isn't called when an ajax request is done and the page's HTML contents gets modified. QWebReply's loadFinished() does get called when the ajax request is performed but calling findFirst() at this time (as I want to grab some HTML elements contents) doesn't find the elements. I guess it's because it's too soon, the page wasn't renderized yet or something.

    So, my question is: after an ajax update, how do I get HTML elements with findFirst() calling it soon as I see the url of the ajax's request in loadFinished() doesn't return the elements. If I put a button in my webForm and hit it after I see the ajax update is done I can grab the elements successfully, because findFirst() return the proper value.

Log in to reply