I want to open a webpage on client to view the changes on the webpage when posting data to the server.
How can the webpage be displayed together with a HTTP POST request when the values is delivered from B4J?
The following code just works in the background and then PHP handles the values on the server.
A workaround is to send a HTTP GET request in the URL which works, but I prefer to use the POST method to hide the data being sent.
How can the webpage be displayed together with a HTTP POST request when the values is delivered from B4J?
The following code just works in the background and then PHP handles the values on the server.
A workaround is to send a HTTP GET request in the URL which works, but I prefer to use the POST method to hide the data being sent.
B4X:
Sub SendPostRequest
Dim val1 As String = "Hello"
Dim val2 As String = "World"
Private sendjob1 As HttpJob
sendjob1.Initialize("", Me)
'Send a POST request
sendjob1.PostString("https://www.mydomain.com/mypage.php", _
"val1=" & myVariable1 & _
"&val2=" & myVariable2)
Wait For (sendjob1) JobDone(sendjob1 As HttpJob)
If sendjob1.Success Then
xui.MsgboxAsync("Data was successfully sent to server.", "")
' How to display the webpage with changes in this process?
End If
sendjob1.Release
End Sub
Last edited: