So I'm completely new to making Ajax requests. I understand the whole concept but am getting stuck in one area...the building of the URL's to make the request. Does anyone know of a any resources to dig into for this?
For example, I'm currently trying to access economic data. They give you the base URL, and then I'm assuming you have to build it up from there to query the correct data. My problem is I've never done this, and have no idea what I'm looking at. Here is their link for an example:
http://www.census.gov/data/developers/data-sets/economic-indicators.html
http://api.census.gov/data.html
Any source you could point me towards to learn this stuff would be much appreciated. Thanks.
Use jQuery. I find the syntax to be much less confusing than vanilla request. Then, when you are building the url, you just provide the vanilla url and then provide the data in a querystring.
data= "attr1=hello&attr2=world",
Good luck!
Full code example:
$.ajax({
url: "someurl.php",
data: "attr1=hello&attr2=world",
method: "GET or POST",
success: function(e) {
//Do something with the data, e, here
}
});