search by tags

for the user

adventures into the land of the command line

jquery ajax cheatcheet

I only have two so far… because… I only used these two…

GET

$.ajax({
  method: "GET",
  url: "https://www.google.com"
});

POST then take the response and do something with it

var data = {
  "key1": "some value",
  "key2": "some other value",
  "key3": "some more values"
};

$.ajax ({
  type : "POST",
  url : "http://my.groovy.url",
  data: JSON.stringify(data, null, '\t'),
  contentType: 'application/json; charset=UTF-8',
  success: function(result) {
    try {
      var myobj = JSON.parse(result.content);
      JSON.stringify(result.response_status_code)
    }
    catch(err) {
      .
      do something here...
      .
    }
  }
});