Hi I got this jquery thing called jquery-endless-scroll. My code looks similar to this:
$(function() {
$('#list').endlessScroll({
pagesToKeep: 10,
fireOnce: false,
insertBefore: "#list div:first",
insertAfter: "#list div:last",
content: function(i, p) {
$.get('http://google.com', function(data) {
return '<li>' + data + '</li>'
});
},
ceaseFire: function(i) {
if (i >= 10) {
return true;
}
},
intervalFrequency: 5
});
});
My main Problem is the content it should return. The rest is not so important.
I want it to return the html markup of google.com but instead of returning this markup it returns nothing. What am I doing wrong?
You can not do this using client side Javascript because of Cross-Domain policy issue for security purpose. But if try to read file’s content on the same domain your script is running on, then it will work.
You should use node.js – a server side Javascript for such stuff:
http://net.tutsplus.com/tutorials/javascript-ajax/web-scraping-with-node-js/