[英]How can i post data using this code below and also tell user to wait while sending message
Iam currently using b4a for android我目前正在为 android 使用 b4a
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
You are using j.PostString
which sends a post request.您正在使用发送发布请求的
j.PostString
。 However, you are not using it correctly.但是,您没有正确使用它。
j.PostString
requires a second parameter: the post data. j.PostString
需要第二个参数:发布数据。 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. B4A 希望您在 url 之后输入逗号和第二个参数,但您只向 function 提供 1 个参数(网址)。 However, looking at your URL, it seems like your backend is handling stuff through GET requests only anyway, not POST.
但是,查看您的 URL,您的后端似乎只是通过 GET 请求处理内容,而不是 POST。 So really, what you should be using is
j.Download
.所以真的,你应该使用的是
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
.完全相同,但它使用的是
Download
而不是PostString
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.