Once not probyval, but always gives out null . My domain, id = "page" on the pages too.

alert (data) returns the code for the entire page, but only #page is needed.

$.get('http://mysite.ru/support', function(data) { alert($('#page', $(data)).html()); // выдает null }); $.get('http://mysite.ru/support', function(data) { alert($('#page', data).html()); // выдает null }); $.get('http://mysite.ru/support', function(data) { alert($(data).find('#page').html()); // выдает null }); 
  • There may be a problem with the requested page. And why should you request the whole site for '#page'? Maybe it is necessary to use JSON or JSONP. - Vahan Av
  • @Vahan Av, there are no problems in the requested page. because alert (data) returns the code for the whole page ... - ModaL
  • And you can see the code of the page itself. - Vahan Av
  • @Vahan Av, pastebin.com/gCJ5FtFj . id = "page" after <body> - ModaL
  • What version of jQuery? - Zhukov Roman

2 answers 2

And for sure, data is just a string and not a jQuery element

 $.get('aaa.html', function(data) { $input = $('<div>', { id: 'myId', class: 'myClass' }); $input.html(data); alert($input.find('#page').html()); }); 

or via XML.

  • @Vahan Av, probyval and so. But you just can not imagine how the browser hangs. - ModaL
  • I just did not hang it first came to mind. And so I initially would use JSON and not get. - Vahan Av

Maybe I'm a fool, but I did this:

 response = data; response.match(/<div id="page">([\s\S]*)<\/div>/i).toString(); 
  • also option - Vahan Av