]>
Commit | Line | Data |
---|---|---|
60024cc8 MT |
1 | $.query = function(name){ |
2 | var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | |
3 | return results[1] || 0; | |
4 | } | |
5 | ||
c9275d4e | 6 | /* $(".planet-search-autocomplete").typeahead({ |
a3e3c96d | 7 | source: function(query, process) { |
8876f3df | 8 | $.get("/api/planet/search/autocomplete", { q: query }, function(data) { |
a3e3c96d MT |
9 | if (data.query == query) { |
10 | process(data.results); | |
11 | } | |
12 | }); | |
13 | }, | |
c9275d4e | 14 | }); */ |
a3e3c96d | 15 | |
0e824faf MT |
16 | function getCookie(name) { |
17 | var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); | |
18 | return r ? r[1] : undefined; | |
19 | } | |
20 | ||
21 | jQuery.postJSON = function(url, args, callback) { | |
22 | args._xsrf = getCookie("_xsrf"); | |
23 | $.ajax({url: url, data: $.param(args), dataType: "text", type: "POST", | |
24 | success: function(response) { | |
25 | callback(eval("(" + response + ")")); | |
26 | } | |
27 | }); | |
56fdd02c | 28 | }; |