I am trying to send array from javascript to XHR.get request in Luci Openwrt .
var myarray[] has some contents . for example : `myarray[] = {"1","2","3"}`
I need to pass this array to XHR.get
requests as arguments . How can i pass this array ?
This is sample code :
XHR.get('<%=REQUEST_URI%>', {status: 2,value: myarray},
function(x, info) {
if (!info) {
location.href=location.href;
}
else {
console.log("success");
}
}
);
and in Lua code I am receiving this form data :
if luci.http.formvalue("status") == "2" then
local DetailValue[] = luci.http.formvalue("value")
local fileContent = {
content = "sample1",
find = "sample2"
}
luci.http.prepare_content("application/json")
luci.http.write_json(fileContent)
return
end
But I am getting errors. Is this correct way to send array via XHR.get ? Any suggestions ?
Here is an example for one value
When I attempted to pass in two query parameters with the same key I got the the following
This time example was
test1
So in your case seems like you will have to have unique parameter keys.