开发者

Get html data from a web page which is populated by ajax

开发者 https://www.devze.com 2022-12-10 20:01 出处:网络
I\'ve a web page on which certain section is being populated by ajax. I want this data. I\'ve written a java program which posts the data and submit the form but unable to fetch the ajax content of th

I've a web page on which certain section is being populated by ajax. I want this data. I've written a java program which posts the data and submit the form but unable to fetch the ajax content of the response.

My application is a core java app.

I'm simply posting data/submitting form with all request parameters set 开发者_如何学JAVAcorrectly. But not getting the data in response which is populated by ajax. :-(

How can i get that data? Any suggestions?


Standard ajax requests have an additional HTTP X-Requested-With header. If they are filtering requests by type you will get nothing.

Accept  application/json, text/javascript, */*
...
X-Requested-With    XMLHttpRequest

As people commented try it on Firefox with Firebug addon and check the request headers.


Also, if you are trying to use AJAX to get data from different domain, you are going to fail miserably. You would need to create a proxy for that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号