I have to load multiple HTML parts in several divs with the class ‘result’ and a unique id.
$('.result').load('/check.php',
{'id': this.id, 'url':'<?=$url?>'}
);
A PHP script (check.php) will generate different HTML according to the parameters it gets (id & url). I want to pass this.id as a parameter, but the pages never get loaded.
this.id is a string right? If I replace this.id by say ‘hello’ it would work.
If you’re expecting
this.idto be the ID of each individual.resultelement as passed to.load, that won’t work. Your code doesn’t create a new context, sothiswill be whatever it was outside of the.loadcall.This should work:
because the
.eachcall does setthisto each of the selected elements, in turn.