vb4android - 我如何使用下面的代码发布数据并告诉用户在发送消息时等待
问题描述
我目前正在为 android 使用 b4a
这是出现的错误
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
解决方案
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
.
推荐阅读
- python-3.x - 如何使用 python 启用 Taskscheduler?
- floating-point - QML 如何处理布尔不透明度值?
- vb.net - Dim Numbers as integer from a Textbox
- javascript - Discord.js TypeError:无法读取未定义的属性“id”-channel.id
- c# - 在 C# 中启动可执行任务与进程
- sql - 如何在 SQL Server 中删除 N 天前的临时/临时表
- javascript - 如何在 Angular2+ 中渲染后执行函数
- javascript - 下面的正则表达式是什么意思?
- python - 我如何使用字典作为类的参数并使用它?
- angular - Material Select Default Selected item第二次不起作用