The Django project USES JS to implement the method of loading child pages and passing values

  • 2020-10-07 18:45:39
  • OfStack

During the development of Django, there were a number of features that enabled JS to load a part of a page (a child page) based on the user's choice. If there is a value in the child page that we need to pass in. You can do it this way

Called in the js function


$("#base_page_div1").load('SUB_URL #sub_page_div1');

Here SUB_URL only needs to be multiple parts based on the parent page for URL. For example, URL of the parent page is /resource/base_url/ child page is:


/resource/base_url/sub_url/

SUB_URL is sub_url

Render URL for this subpage as one of the other pages is sufficient. Like the parent page.

Where #sub_page_div1 is not required. Can be used as a parameter passed to a child page. This is the category of JS passvalue.


Related articles: