I'm in an interesting spot. I'm fairly new to Full-Stack, so I'm not even sure what I am trying to do is possible...so bear with me. I'm trying to create an RSS aggregator that can collect the contents of the articles via rss and filter them based on content. Regardless,
I'm using an ajax call through JQuery in a javascript file that is not attached to any HTML page. It is called via app.js as
var GetRSS = require('./public/javascripts/GetRSS.js');
Inside the GetRSS file:
$.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
error: function(){
alert('Unable to load feed. Incorrect path or invalid feed.');
},
success: function(xml){ // Save items after successful read. They will eventually go into a database.
values = xml.responseData.feed.entries;
var art = new Article(values);
var pretty = JSON.stringify(values,null,2); // This is for printing purposes (when needed).
console.log("1");
populateArticle(values);
}
However, when I spin-up the server, it get the following error:
$.ajax({
^
ReferenceError: $ is not defined
I try and include javascript by adding:
var jQuery = require('./jquery.js');
But it doesn't help. To iterate, I do not have an HTML file at this moment, as it will simply load content from the DB that is "GetRSS" file is always running and populating. Everywhere I've looked online ties JQuery to the JS file by using script tags in HTML.
Is it possible to utilize the JQuery library in the manner I am trying? If not, what's another option?