$(document).ready(function(){ $("#loadtext").click(function(){ $("#loader").load("text.html"); }); }); $(document).ready(function(){ $("#loadimg").click(function(){ $("#loader").load("images.html"); }); }); $(document).ready(function(){ $("button").click(function(){ $("#loader").addClass('color'); }); }); $(document).ready(function(){ $("#loadblock").click(function(){ $("#loader").load("https://myrusakov.ru/ #slider"); }); }); 
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>NoNaMe</title> </head> <body> <div id="" class="block"> <ul> <li>ΠŸΠ΅Ρ€Π²Ρ‹ΠΉ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ</li> <li>Π’Ρ‚ΠΎΡ€ΠΎΠΉ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ</li> <li>Π’Ρ€Π΅Ρ‚ΠΈΠΉ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΉ</li> </ul> <button id="loadimg">Π—Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ΡŒ изобраТСния</button> <button id="loadtext">Π—Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ΡŒ описаниС</button> <button id="loadblock">Π—Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ΡŒ myrusakov</button> <div id="loader" class="result"> </div> </div> <script src="jquery.min.js"></script> <script src="common.js"></script> </body> </html> 
screen output element: enter image description here

The last request for myrusakov.ru #slider simply not executed, nothing is displayed - why? what's wrong ?

  • I went to the link, I didn’t find a single element with the a--box class, and there are no tags like hentry and aid-1830363971 in nature. Accordingly, the selector will not return anything. - Sergey Gornostaev
  • For complete clarity does not hurt. - Sergey Gornostaev
  • First, the selector must be exactly as shown .a--box.hentry.aid-1830363971.answer . Secondly, if you view the source of the page, and not the DOM, then there is no data there, which means they are dynamically generated and it’s not a fact that jQuery.load can handle this. Finally, mail.ru does not give its data to the side: No 'Access-Control-Allow-Origin' header is present on the requested resource. - Sergey Gornostaev
  • although by itself it doesn't matter where to output from, I can parse to php, but load is not given to me - user33274
  • one
    Guys, stop talking about a topic that is not possible with jQuery. load () cannot access another site. Parsite on php. - Maqsood

1 answer 1

JavaScript or jQuery cannot retrieve data from another domain. I will not repeat the answers to hundreds of the same questions in this forum, I recommend reading this article about why you can not contact another domain.