How to get Ajax response in Go

Jerry YY Rain

I have used net/http package to get url html response, it works fine until now.
but when I get one page that use Ajax to fill some html element, I could not get all contents of html page.

How can use http.Get that will wait page load completely then get whole web page contents. Thanks!

response, err := http.Get(url)
if err != nil {
    fmt.Printf("%s", err)
    os.Exit(1)
} else {
    defer response.Body.Close()
    contents, err := ioutil.ReadAll(response.Body)
    if err != nil {
        fmt.Printf("%s", err)
        os.Exit(1)
    }
    fmt.Printf("%s\n", string(contents))
}
Greg

Content generated via javascript isn't part of the HTML that the server is sending out. It needs to be evaluated client-side, and since your client in the case is a Go program you will need to do that evaluation yourself.

A library like Otto may help. However, depending on your needs, it may even be better to re-evaluate your tools and make use of a headless "browser" like PhantomJS or similar.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to get $.ajax settings in response?

From Dev

how to get $.ajax settings in response?

From Dev

How to get ajax response in react?

From Java

How to get the value of Ajax response in jQuery

From Dev

How to get the data response from ajax request?

From Dev

how to get ajax response to trigger click

From Dev

how to get an element added from an ajax response

From Dev

How to get Ajax response in Struts2

From Dev

How to get the data response from ajax request?

From Dev

How to get requested url from ajax response?

From Dev

how to get ajax response to trigger click

From Dev

How to Parse/get Ajax delayed response

From Dev

get fields in ajax response

From Dev

Ajax response empty GET

From Dev

How to get the ajax response from success and assign it in a variable using jQuery?

From Dev

How to get AJAX response before sending to template using DATATABLES?

From Dev

how to get ajax response in html with out any html code attached to it

From Dev

how to get JSON response from servlet to jsp page by using ajax

From Dev

How to get the response text from an AJAX request using jQuery

From Dev

how to get response from node server using ajax method in html

From Dev

how to get dynamic value of Json object in ajax response

From Dev

How to get ajax response in php while edit popup

From Dev

How I get ajax response from controller in magento 2

From Dev

How to get the ajax response from success and assign it in a variable using jQuery?

From Dev

How to get response text from ajax callback in a variable using ExtJS

From Dev

how do i get a response from a jquery ajax request

From Dev

How to get data param on the destination page from Ajax response call

From Dev

how to get dynamic value of Json object in ajax response

From Dev

How to get response from PHP file as an array using Ajax?

Related Related

  1. 1

    how to get $.ajax settings in response?

  2. 2

    how to get $.ajax settings in response?

  3. 3

    How to get ajax response in react?

  4. 4

    How to get the value of Ajax response in jQuery

  5. 5

    How to get the data response from ajax request?

  6. 6

    how to get ajax response to trigger click

  7. 7

    how to get an element added from an ajax response

  8. 8

    How to get Ajax response in Struts2

  9. 9

    How to get the data response from ajax request?

  10. 10

    How to get requested url from ajax response?

  11. 11

    how to get ajax response to trigger click

  12. 12

    How to Parse/get Ajax delayed response

  13. 13

    get fields in ajax response

  14. 14

    Ajax response empty GET

  15. 15

    How to get the ajax response from success and assign it in a variable using jQuery?

  16. 16

    How to get AJAX response before sending to template using DATATABLES?

  17. 17

    how to get ajax response in html with out any html code attached to it

  18. 18

    how to get JSON response from servlet to jsp page by using ajax

  19. 19

    How to get the response text from an AJAX request using jQuery

  20. 20

    how to get response from node server using ajax method in html

  21. 21

    how to get dynamic value of Json object in ajax response

  22. 22

    How to get ajax response in php while edit popup

  23. 23

    How I get ajax response from controller in magento 2

  24. 24

    How to get the ajax response from success and assign it in a variable using jQuery?

  25. 25

    How to get response text from ajax callback in a variable using ExtJS

  26. 26

    how do i get a response from a jquery ajax request

  27. 27

    How to get data param on the destination page from Ajax response call

  28. 28

    how to get dynamic value of Json object in ajax response

  29. 29

    How to get response from PHP file as an array using Ajax?

HotTag

Archive