jQuery Display Table

This is a how I have used jQuery to build a table from a list that is returned. The table is a list of lists, each element in the list is a row.

Returned List in Python

This is a list of lists, here I am printing each element of the overall list. More on this below

Returned List in Browser for jQuery

jQuery

HTML

Python

I am using two files here, one for the views which is what jQuery uses, and one to setup the F5 API depending on whether it is a; check, change or rollback.
I have not included the F5 API function as this is not really important.

There are three main functions;

  • new_defaults2
  • create_gsov2_api
  • return_me

new_defaults2

new_defaults2 is used to start the process of creating the API that will be sent to the F5, it is also responsible for taking the F5 returned JSON and passing it into another function.

create_gsov2_api

create_gsov2_api is used to create the F5 API for each SSL profile according the different F5 IP

return_me

return_me is used to the actual list returned to jQuery. This is what is used by jQuery to create the table

How it Works together

  1. User enters one or more domains
  2. Web page is rendered for with button
  3. User presses button
  4. On button press jQuery calls for view in Flask that starts the process
  5. API is created and sent to F5 or F5s (based on the domain or domains the user input)
  6. Returned JSON is parsed for specific elements in the JSON output
  7. That is then returned to jQuery as list of lists, one for each SSL profile the user entered
  8. jQuery builds the table and renders it on the web page

Leave a Comment

Your email address will not be published. Required fields are marked *