# confused about python function calling

**URL:** <https://forum.djangoproject.com/t/confused-about-python-function-calling/9885>\
**Category:** Using Django\
**Created:** [September 28, 2021, 6:54pm UTC](https://forum.djangoproject.com/t/confused-about-python-function-calling/9885 "2021-09-28T18:54:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ukrolelo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ukrolelo/32/4193_2.png) [@ukrolelo](https://forum.djangoproject.com/u/ukrolelo)\
**Post date:** [September 28, 2021, 6:54pm UTC](https://forum.djangoproject.com/t/confused-about-python-function-calling/9885/1 "2021-09-28T18:54:29Z")

</div>

Greetings,  
I have rendered html view where i have regular tr td table.  
I want to be able when i click on a highlighted row to call a python function with some data for example row id and return data on modal popup.

For now i have prepared crispy form with modal popup.  
But i need to forward some data on click function and return it back to render.

Or all the data must be rendered right away on the first render?

Idk if my explanation is clear.  
Thank you

EDIT 1:  
Have found this, but its a button not tr td row

> **[How do I call a Django function on button click](https://www.edureka.co/community/73109/how-do-i-call-a-django-function-on-button-click)**
>
> I am trying to write a Django application and I am stuck at how I can call a view function ... without refreshing the page. How I can achieve this?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 28, 2021, 7:03pm UTC](https://forum.djangoproject.com/t/confused-about-python-function-calling/9885/2 "2021-09-28T19:03:04Z")

</div>

It’s basically the same - you’re catching a button click in the browser (JavaScript), and then calling a view (AJAX) from the browser (also using JavaScript) and using the results of that AJAX call to update the page (still using JavaScript).

Always be mindful that “rendering a template” occurs in Django on the server, producing a page (or fragment of a page). Once that page has been sent to the browser, Django is _done_ with it.  
Requesting new data, or a new fragment of a page, would be the calling of another view - and requires JavaScript involvement in the browser.

---

<div class="post-metadata">

**Author:** ![ukrolelo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ukrolelo/32/4193_2.png) [@ukrolelo](https://forum.djangoproject.com/u/ukrolelo)\
**Post date:** [September 28, 2021, 7:06pm UTC](https://forum.djangoproject.com/t/confused-about-python-function-calling/9885/3 "2021-09-28T19:06:33Z")

</div>

Hi,thank you! Omg so many middlemans.I thought it will be possible to just do some mumbo jumbo with python.  
I have basic javascript and no ajax knowledge.  
Can you give me some links? I am googling for 40minutes and cant find the solution i want D:

Will try to google again with ajax and javascript

---

<div class="post-metadata">

**Author:** ![ukrolelo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ukrolelo/32/4193_2.png) [@ukrolelo](https://forum.djangoproject.com/u/ukrolelo)\
**Post date:** [September 28, 2021, 7:07pm UTC](https://forum.djangoproject.com/t/confused-about-python-function-calling/9885/4 "2021-09-28T19:07:19Z")

</div>

Does this looks like what i want?  
[https://www.py4u.net/discuss/18510](https://www.py4u.net/discuss/18510)
