DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Simulate XHRs With Wget

  • submit to reddit
        To test AJAX calls when developing a webapp, XHRs can be simulated by wget:

wget --header="X-Requested-With: XMLHttpRequest" <your-url-here>

wget saves the request to a file by default. To print to the command line: 
wget --header="X-Requested-With: XMLHttpRequest" -qO- <your-url-here>

<a href="">Google Groups reference</a>
<a href="">wget reference</a>