How can i post data using this code below and also tell user to wait while sending message

89 Views Asked by At

Iam currently using b4a for android

here is the error which comes

enter code here
 ',' expected.`enter code here`


enter code here
Dim j As HttpJob
            j.Initialize("", Me)
            j.PostString($"http://kccug.com/KabojjaApp/RecieveSMS.ashx?customerId=${act}&s=${edtMessage.Text}&d=${getdate(DateTime.Now)}&id=${NewID}&ph=${phone}&f=${sx}"$ )
            Wait For (j) JobDone(j As HttpJob)
            If j.Success Then
                Log(j.GetString)
            End If

enter code here
1

There are 1 best solutions below

0
On

You are using j.PostString which sends a post request. However, you are not using it correctly. j.PostString requires a second parameter: the post data. B4A expects you to put in a comma and the second paramter after the url, but you are only giving 1 parameter (the url) to the function. However, looking at your URL, it seems like your backend is handling stuff through GET requests only anyway, not POST. So really, what you should be using is j.Download. Try this code:

Dim j As HttpJob
j.Initialize("", Me)
j.Download($"http://kccug.com/KabojjaApp/RecieveSMS.ashx?customerId=${act}&s=${edtMessage.Text}&d=${getdate(DateTime.Now)}&id=${NewID}&ph=${phone}&f=${sx}"$)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
    Log(j.GetString)
End If

It's exactly the same, but it uses Download instead of PostString.