mardi 20 décembre 2016

What do these AJAX Parameters do?

I'm analyzing this CodePen's code, which lets the user search any item within Wikipedia (through Wikipedia's API), and the search engine shows the first 10 results and brief summaries. Analyzing other people's code is (IMO) one of my best ways to learn, along with reading guidebooks and finishing tutorials.

The AJAX code I couldn't understand, is this:

$.ajax({
url: "http://ift.tt/1ombvMM",
jsonp: "callback",
dataType: 'jsonp',
data: {
  action: "query",
  list: "prefixsearch",
  pssearch: $(".searchbox").val(),
  pslimit: "10",
  format: "json"
},
xhrFields: {
  withCredentials: true
},
success: updateSuggest,
error: function(err) {
  console.log(err);
}

});

Idont understand what these 4 data parameters (action, list, pssearch, pslimit) do. What exactly are these 4 parameters' functions... can someone explain them? For example, what does "pssearch" and "list" and "pslimit" do?

I tried looking these terms up on the API.JQuery website and google searches, but no avail.




Aucun commentaire:

Enregistrer un commentaire