我必须能够与请求的网络地址中的servlet接口并获取此请求的结果但不起作用
代码:
function onLoginBtnRelease(event)
network.request( "http://localhost/foodingame/searchPlayer?userName="..utente.text.."&password="..password.text, "GET", networkListener )
end
local function networkListener( event )
if ( event.isError ) then
print( "Network error!")
else
local myNewData = event.response
print ("From server: "..myNewData)
local decodedData = (json.decode( myNewData))
if(decodedData.find(utente.text)) then
messaggio.text = "Persona trovata"
else
messaggio.text = "Persona non trovata"
end
end
end
答案 0 :(得分:0)
您必须先声明networkListener函数,然后才能使用它。只需翻转功能的顺序。