Q:

How to load external page content into current page?

I am running this bit, where basically I want to load part of an external page content into current page using .load()
JS
$(".rounded-circle").on("click", function (e) {
  e.preventDefault();
  var url = $(this).next("span").data("gal") + " .carousel";
  console.log(url);
  $(".gallery").load(url);
});

var url gives: http:/example.com/mypage.php .carousel
mypage.php does have a content within a class .carousel
But the above gives:

jquery-3.3.1.min.js:2 Uncaught Error: Syntax error, unrecognized expression: http:/example.com/mypage.php .carousel

This works:
$(".galleria").load("http:/example.com/mypage.php");

But I only want to get content of the external page within .carousel and not the whole page.

A:

I am providing a working answer in order not to leave blank. Eventually I have wrapped the content I want to load within a div with an ID and it works. Yet one of the comment demonstrated that it should also work with a class, but in my case wasn't and since I don't mind the other solution, I leave it like that, so...
Note: I have also changed the way I was getting the url and I now grab it from the href directly.
$(".galLInk").on("click", function (e) {
  e.preventDefault();
  var url = this.href + " #galleriaSingle";
  console.log(url);
  $(".galleria").load(url);
});

