I need insert result from jQuery load to variable.
Content of elemtent with id test on page ajax.html.
$('#result').load('ajax.html #test');
Try using jQuery.get
instead.
Eg.
$.get('ajax.html', function (data) { data = $(data).find('#test'); // data contains your html });
$('#result').load('ajax.html #test', function(result) {
var variable = $('#result').html();
});
More or less doing the same as above but simpler:
var dt;
$.get("ajax.html", function (data) {
dt = data;
// data contains your html
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With