I have a div that contains people's names, which is coming dynamically.
I want to show related content of people, when it's clicked. For that, I need to pass name of person to javascript when div is clicked.
How can I achieve this?
Note: I am not using any button.
for example:
$('#parent_block_that_not_insert_dynamicly').on('click', 'div.that_add_dynamycly', function() {
var data = $(this).text(); //get name
$.ajax({
method: "POST",
data: data,
url: "url.php"
})
.done(function(msg) {
alert('saved')
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.