Reputation: 705
I'm currently working on making an chrome app that uses javascript to make download buttons. I want the app to take the current page + append "/download" on it. Then it would request HTML code from that link.
<div class="download-row">
<a href="http://www.website.com">A website</a>
</div>
It would take the href from the download page, then create buttons with the href on the original page.
OK I tried this on the website and 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 I tested this in chrome's console, it printed out:
GET http://www.mywebsite.com/download 404 (Not Found)
Uncaught TypeError: Object <!DOCTYPE html>
<html lang="en-us">
<head>
....
....
HTML data from the page.
Upvotes: 0
Views: 2020
Reputation: 4078
You can use http://api.jquery.com/load/ to load data from other page. A sample example from jQuery documentation
$('#result').load('ajax/test.html #container');
There are many other demos available, try it. And if not use Ajax.
Upvotes: 1