The issue is that for a contextual selector to work the second argument of the jQuery object needs to be an Element or jQuery object, or a selector string (ref). Given the context of your code, I would presume data
holds HTML, not a selector.
To fix the issue you can provide data
to a jQuery object and then find()
the required element:
var url = '/category-one/';
$.ajax({
url: url,
success: function(data) {
let $data = $(data);
let $fullContent = $data.find('#products-count');
let text = $fullContent.text();
console.log(text);
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…