Reputation: 3809
I'd like to use .load to add a button, that exists on another page, for each cell on a website.
Let's say it looks like this:
Lalalala
Videooooo Here
Wop wop Wop wop
and all of those would be links. Then if you go to each link, for example "Lalalala", you'd go to a page looking like this:
Info here, blabla. Lala
So, I tried to use:
$(".mainpart").append("Magnet: <div id='magneturl'>Loading download buttons..</div>");
$("#magneturl").load("zoo-s01e04-hdtv-x264-lol-ettv-t10975316.html");
But if I use:
$(".mainpart").append("Magnet: <div id='magneturl'>Loading download buttons..</div>");
$("#magneturl").load("zoo-s01e04-hdtv-x264-lol-ettv-t10975316.html .magnetlinkButton");
It will just print Magnet:
I hope I make any kind of sense with this post.
Upvotes: 0
Views: 547
Reputation: 4383
The line
$("#magneturl").load("zoo-s01e04-hdtv-x264-lol-ettv-t10975316.html .magnetlinkButton");
is trying to fetch the content of the page and filter it applying the jQuery selector .magnetlinkButton
. Judging by the image you posted, the file you are loading is not an HTML page but a JSON; or maybe it is HTML, but it doesn't have any element with class="magnetlinkButton"
.
If you are actually trying to read the property .magnetlinkButton
from that JSON text, I'd suggest looking into .getJSON() instead.
Upvotes: 4
Reputation: 380
check your jquery version. here is the working example :
<!doctype html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<b>Projects List:</b>
<ol id="new-projects"></ol>
<script>
$( "#new-projects" ).load( "/resources/load.html #projects li" );
</script>
</body>
Upvotes: -1