Yes of course it is possible. I am not sure what your bullet points actually mean however.
Of course AJAX gives you data, but that data could include HTML if you wanted. Even if you want to keep HTML out of it (which would be a good idea) you can take the data returned and append, change or even create your cards on screen.
This too would be very much like the AJAX solution except you would have all the data loaded at the same time. Not very scalable if the number of list items or card data is large. The one benefit here is that you could cache the data after fetching it and would then not need to make multiple AJAX requests.
Not sure why you are mentioning iFrames when you specifically say you don’t want iFrames. Either way, given the first two points I really don’t think you need iFrames here. iFrame use is very rare I find these days. It is much easier to do AJAX and then display on page using your JavaScript.
Did you have a more specific question about these options or are you looking for an opinion on which way to go? Personally I think option 1 is the way to go if you have a ton of list items. Option 2 if the items are small and you want it to be really responsive by using a local cached copy of the card data.
The rendered data + html is loaded by the web server (Go) so I need to fetch the html together with the data. I do not know anything about AJAX, and how to incorporate the data with the html. Any clue is welcome.
This too would be very much like the AJAX solution except you would have all the data loaded at the same time. Not very scalable if the number of list items or card data is large. The one benefit here is that you could cache the data after fetching it and would then not need to make multiple AJAX requests.
Loading all data into a table can be expensive. As the SQL query can be massive and I guess that building the table as well. And the problem is the same as with AJAX. How do i pour the data into the html?
Not sure why you are mentioning iFrames when you specifically say you don’t want iFrames. Either way, given the first two points I really don’t think you need iFrames here. iFrame use is very rare I find these days. It is much easier to do AJAX and then display on page using your JavaScript.
I did not say I don’t want iframes. I just want to know if there is other options or if iframes is the best option.
Did you have a more specific question about these options or are you looking for an opinion on which way to go? Personally I think option 1 is the way to go if you have a ton of list items. Option 2 if the items are small and you want it to be really responsive by using a local cached copy of the card data.
Yes, I am looking for opinions. And feedback. And how others do solve this?
What is the pros and cons with iframes? Any clue that can make this faster, simpler and safer.
Looks like you wanted a solution not using iFrames to me.
Ok well, not sure how the size of the query matters… but if the data coming back is going to be a lot, then ok rule out option 2.
It sounds like AJAX would be the best option for you here. However, you say you don’t know anything about AJAX. So it looks like a great little project to learn on and do it! AJAX these days is not that hard given the development of libraries and APIs.
Great place to start! If you are using jQuery, you can try the jQuery AJAX article there otherwise you can try the article labeled “A Guide to Vanilla Ajax Without jQuery”.
Either way, I think you have some solutions there to play with. I hope it helps.
Go is compiled to a single executable server side file that outputs a HTML stream of text. This text is then parsed and rendered in a browser. The html output can be validated:
Thank you! I will give it a try. But how to get the data inside the html is a complete mystery to me.
To hide and show the card is no problem. The problem is that the card does not even exists when the main window is rendered. The card must be “produced” and rendered “on-the-fly” and injected into the existing main window. My example shows that iframe works, but I was asking if there was other options.
Can you elaborate on how the “card” data is found.
If the “card” data i coming from a database table then I cannot see why the “card” details are not found before displaying the list.
Edit:
I do something similar by using a JavaScript AJAX Search that calls a PHP file that accepts the search parameters, passes the parameters to a MySql database query, retrieves the results that are passed back to the browser to be rendered:
I created 3 websites in order to figure out speed and simplicity. The table is fetching 5.000 records to enhance the differences. The live sites still require a bigger screen.
#1 Pure Go SSR
The webserver gets the API requests for both list and card. No AJAX involved. The card is filled in as an <iframe> src="url"</iframe>
#3 Go for the list SSR + AJAX for the card
The webserver gets the API requests for the list (table). And the card is filled by innerHTML by an AJAX call.
Thanks for the input. In order to make it clear, I over simplified the example.
In reality there will be maybe 50 columns in the “card” and accordion is just what I thought should be excellent to group information.
But in the “list” with maybe 10 columns, the accordion way will be hard to grasp.
So, what I am searching for is a way to load lists in a fast and simple way. My guess is that both Go and AJAX will be to slow to handle 5000 rows. This number of rows is “just-to-show-the-problem”.
The overall goal is to create an expandable “admin” template for SQL-data based on CRUD. My intention is to create a user interface that focus on speed and simplicity. Using as few “languages” as possible in order to make it maintainable for years. The live links in this thread are just a mini minor step towards this goal. The first sub goal is to load data and present it as fast and reliable as possible.