I am trying to send a javascript array via url.But this fails
function viewReport(mode,someid){ if(mode==0){ var para= new Array(); para['para1'] = 'para1'||0; para['para2']= 'para2' || 0; console.log(para); window.open('somePDFView/'+para,'_blank'); }else{ var para=[]; var paraelements={ para1:'anotherpara1'||0, para2:'anotherpara2'||0 }; para[0]=paraelements; window.open('somePDFView/'+para,'_blank'); } }
In if part(mode=0) para array no longer sends, and on the other part ( mode=1 ), para is sent as follows:
somePDFView/[object Object]
What the error shows:
The URI you submitted has illegal characters
How can we send an array via url.I cannot use Ajax (because its a popup) or a session or store in a temporary table. Just like we can get this value in the controller.
Edit:
I miss the important thing that I use codeigniter. Then I think that this prohibits special characters such as - &, =, [,], etc. So if any other methods are available to send data as an array? ..
source share