Consider this line:
<div onload='getContent();'></div>
I have the following JS function:
function getContent() {
$.ajax({
url: '/ContentController.php',
success: function(data) {
//change the html of the element this was called on, "TARGET"
$(TARGET).html(data);
}
});
}
I want to select the element that the function was called on without using IDs so for example, if the data returned as "Hello World" the above html would look like this:
<div onload='getContent();'>Hello World</div>
Is there a way to do this?