If your server is Unix/Linux and you have php and myPhpAdmin on your server and you want to send some data to your server that has mySQL (or similar) installed then in NSB:
Create a string something like this: postData = “data1=” & data1 & “&data2=” & data2 & “&data3=” & etc.
Each data string will be returned in your php script and can then be inserted into SQL where desired.
AjaxWaitTime = Now
TS = SetInterval(TestAjaxDone,1000)
If DateDiff("s", AjaxWaitTime, Now) > 4 Then
M = "Unable to connect to the server at this time, please try again later."
Call ShowMsg(M,0, "No Connect")
If req.readyState<> 4 Then
If DateDiff("s", AjaxWaitTime, Now) > 10 Then
M = "Unable to connect to the recipeRasa server at this time, please try again later."
Call ShowMsg(M,0, MsgTitle)
If req.status=200 Then 'success
s = req.responseText
M = "Problem (error " & req.err & "). Verify that you have an Internet connection and try again."
Call ShowMsg(M,0, "Error Sending Data")
There are 2 tests following the POSTing of the data. The Function AjaxDone is what you want to happen. But it doesn’t always work that way. So the first Function TestAjaxdone gives the app 4 seconds to get a response from the server. If AjaxDone is called before the 4 seconds then all is good and the TS interval is ended. Not sure if the 10 second wait is really required in AjaxDone but it seems to work for me so I have left it in.
Note: ShowMsg is one of my functions, substitute the NSB Message box. The code for the php script is another matter. If you want an example I can post that here.