javascript - How to request div content from another site -
i'm working on making chrome app uses javascript make download buttons. want app take current page + append "/download" on it. request html code link.
<div class="download-row"> <a href="http://www.website.com">a website</a> </div> it take href download page, create buttons href on original page.
ok tried on website , i'm having syntax issues.
var links = "" $('#right').load('www.mywebsite.com/download', function(data) { data.find(".download-row a").each(function(){ links += $(this).attr("href"); });}); when tested in chrome's console, printed out:
get http://www.mywebsite.com/download 404 (not found) uncaught typeerror: object <!doctype html> <html lang="en-us"> <head> .... .... html data page.
you can use http://api.jquery.com/load/ load data other page. sample example jquery documentation
$('#result').load('ajax/test.html #container');
there many other demos available, try it. , if not use ajax.
Comments
Post a Comment