from django.http import HttpResponse def trigger_my_action(request): # 1. Run your Django module/function result = "1" print('here') # 2. Return ONLY the HTML fragment you want to show on the page # This will replace the content inside the "hx-target" div return HttpResponse("Done!")