javascript - Get window url inside JSON -



javascript - Get window url inside JSON -

is there way window's url within json. tried below doesn't working. json used display widget. below snippet of code.

cq.wcm.contentfindertab.getresultsboxconfig({ "itemsddgroups": [cq.wcm.editbase.dd_group_asset], "itemsddnewparagraph": { "path": "foundation/components/image", "propertyname": "./filereference" }, "norefreshbutton": true, "tbar": [ cq.wcm.contentfindertab.refresh_button, "->", { "url": "/bin/wcm/contentfinder/asset/viewnew.json"+window.location.href; }, { "baseparams": { /*"defaultmimetype": "image"*/ "mimetype": "image" }, "autoload":false, "reader": new cq.ext.data.jsonreader({ "totalproperty": "results", "root": "hits", "fields": [ "name", "path", "title", "mimetype", "ddgroups", "size", "lastmodified", "ck", "templateparams", "imagewidth", "imageheight" ], "id": "path" }) })

thanks

there no json here. object literal

you need remove trailing semicolon object send , perhaps add together parameter name. encode url

{"url": "/bin/wcm/contentfinder/asset/viewnew.json?url="+ encodeuricomponent(window.location.href) },

if need hash, not need parameter name nor encode

{"url": "/bin/wcm/contentfinder/asset/viewnew.json"+ location.hash},

if there more stuff in hash want, need split

{"url": "/bin/wcm/contentfinder/asset/viewnew.json"+ location.hash.split(".html")[0]+".html" },

or sure:

{"url": "/bin/wcm/contentfinder/asset/viewnew.json"+ (location.hash.indexof(".html")!=-1?location.hash.split(".html")[0]+".html":location.hash) },

javascript json extjs cq5

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -