B4J Question [WebApp] best approach when bulding the site ?

jalle007

Active Member
Licensed User
Longtime User
I'm making a relatively simple site. It has search functionality and articles retrieved fom database (see attachment). Currently I'm doing it like this

B4X:
Sub initHTML
    'risks count (60)
    Dim risks As Int= readDB2("select count(activity_id) from activity")
    ws.Eval("$('#risks').text('" &  risks & "');",Null)

    'generate left menu
    Dim rs As ResultSet= readDB("select title from activity")

    html=" <ul id=""collapseSearch3"" class=""panel-collapse collapse"">"
    Do While (rs.NextRow )
        html = html & "<li><a href=""#""><span class=""blue-arrow""></span> " & rs.GetString("title") & "</a></li>"
    Loop
    html =html & "</ul>"
    rs.Close
   
   
    Dim jq As String ="$('#divcollapseSearch3').html('" & html & "');"
    ws.Eval(jq,Null)

End Sub

Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
    Log("Connected")
    ws = WebSocket1
    initHTML
End Sub

So after page load I read data from db , then generate html and attach it to the index.html via JQuery. IT works BUT I am sure this is not the best way to make simple site. I am using websocket and I believe I dont need this.

Any suggestions are welcome..
 
Last edited:
Top