How to use the cheerio.ajax function in cheerio

To help you get started, we’ve selected a few cheerio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sefaria / Sefaria-Project / static / js / sefaria / sefaria-06.js View on Github external
var extend    = require('extend'),
    param     = require('querystring').stringify,
    striptags = require('striptags');


if (typeof document !== 'undefined') {
  var INBROWSER = true,
      $         = require('jquery'),
      ga        = DJANGO_VARS.ga;
  require('jquery.cookie');
} else {
  var INBROWSER = false,
      $     = require("cheerio"),
      ga    = function() {}; // Fail gracefully if we reach one of these methods server side
  $.ajax    = function() {}; // ditto
  $.getJSON = function() {}; // ditto
}


var Sefaria = Sefaria || {
  _dataLoaded: false,
  toc: [],
  books: [],
  booksDict: {},
  recentlyViewed: []
};

Sefaria = extend(Sefaria, {
  _parseRef: {}, // cache for results of local ref parsing
  parseRef: function(q) {
  // Client side ref parsing without depending on book index data.