简体   繁体   中英

Send json data as url parameters

I m trying to pass json data

var  data = JSON.parse("[" + detail + "]"))
or the results of var detail = $('#grid-table').getCell(rowid, '11') 
results as parameters of the url vers another jsp (a modal).

In the same page, all is good (the jqgrid table is full normally).

Now I want to fill by the same data another jqgrid but in another jsp (in my case is a bootstrap modal) but it displays anything.

var iframeSrc = '<%=request.getContextPath()%>/subgridtable_Device_Modal.html?'+ data + '&' + detail ;)

I saw the below sample of data when I receive the detail variable in the second page :

{%22A%22:%223%22,%22B%22:%222SC2I%22,%22C%22:%223%22,%22D%22:%222SC2I%22,%22E%22:%2245%22,%22F%22:%22PTS3S40510009246%22,%22G

Also I tried to parse the detail to json data in the second page but no results .

Any one have any idea please.

When you pass a variable as a part of a URL it will always be URL-encoded. When receiving such a parameter most server side programming languages will automatically decode it again for you. When that's not the case, you have to manually decode it. I don't know which server side language you're using though. Or if you use JavaScript to receive that parameter, use decodeURI().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM