N
N
Nik17122016-10-11 13:23:46
JavaScript
Nik1712, 2016-10-11 13:23:46

Ajax load how to correctly load with a variable instead of a url?

There is an element that needs to be loaded with Ajax, the
link can change and it is set to a variable
, usually this is done like this $('.element').load('ajax.html #container');
but when the reference is in a variable, how to write it correctly?
something like this comes to mind
var link = 'ajax.html'
$('.element').load('#container', link)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur Grand, 2016-10-11
@Nik1712

$('.element').load(link+' #container');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question