Hi,
How to post data to my own server. I can fetch data from it but can’t add data .Code for fetch is below:
local function networkListener( event )
if ( event.isError ) then
print( “Network error!”)
else
local json=event.response
local length=string.len(json)
json=string.sub(json, 50, (length-1));
jsonTable=JSON.encode(json)
local t = jsonTable
print(jsonTable)
– Go through the array in a loop
for key in pairs(t) do
– Here you can do whatever you like with the values
print(t[key][“AuthorID”])
print(t[key][“AuthorName”])
–print(t[key][“returnvalue3”])
end
end
end
local remoteFeed=“http://www.xtremeesolutions.com/xesapps/webservice/readauthors.php”
network.request(remoteFeed, “GET”, netwotkListener)
And trying code to post data is
local function postData(e)
if (e.isError)then
print("Error ");
else
print("Error "… e.response);
end
end
local params = {
body = query
}
network.request(remoteFeed, “POST”,postData,params))
Above code not giving any error but also not inserting values.Please suggest me to solve this.