kiltjs / jqlite

Tiny JavaScript DOM query library that uses pure CSS selectors
MIT License
99 stars 19 forks source link

Implementing .getJSON() #18

Closed RongBranovate closed 9 years ago

RongBranovate commented 9 years ago

Hi, What would be the best way to implement the .getJSON() function from jQuery?

the jQuery docs say it's basicly a shorthand Ajax function, which is equivalent to:

$.ajax({
  dataType: "json",
  url: url,
  data: data,
  success: success
});

would that work with jqlite ? is there anything that i should change?

Thanks in advance!

jgermade commented 9 years ago

Hi @RongBranovate jqlite aims to be a DOM handling library, you can find specific libraries for this stuff like jengine-http

with jengine-http

$http.get(url, data).then(function (response) {
   console.log('json received: ', response.data);
});
RongBranovate commented 9 years ago

Splendid! thanks!