-
1. Re: Concatenate a loaded JSON URL
QuadrantProductions Oct 30, 2014 12:10 PM (in response to QuadrantProductions)My syntax appears to be off, but I cant tell where?
window.open("('"+data[0].thelink+"')", "_parent")});
The URL is in a JSON file that's being loaded as the JSON variable thelink
Heres the full block.
$.getJSON(myjson, function(data){
{
var s1 = sym.getSymbol("taboption1");
s1.getSymbol("holder").$("placehere").css({"background-image":"url('"+data[0].image+"')"} );
s1.$("thename").html(data[0].thename);
//start mouse events//
sym.getSymbol("taboption1").click(function(){
window.open("('"+data[0].thelink+"')", "_parent")});
}
});
-
2. Re: Concatenate a loaded JSON URL
vivekuma Oct 30, 2014 7:33 PM (in response to QuadrantProductions)I assume you have included the jQuery already.
Syntax for window.open is wrong, it should be like this:
window.open("'"+data[0].thelink+"''", "_parent");
and while adding click event, you should do like like:
sym.getSymbol("taboption1").getSymbolElement().click(function(){
hth,
Vivekuma
-
3. Re: Concatenate a loaded JSON URL
resdesign Oct 31, 2014 6:37 AM (in response to vivekuma)I think for the click event you might want to use:
sym.getSymbol("taboption1").getSymbolElement().bind("click",function() {
-
4. Re: Concatenate a loaded JSON URL
QuadrantProductions Oct 31, 2014 6:42 AM (in response to vivekuma)Thanks vivekuma,
Close! There were a couple of extra ' in your string. Also the correction on the click event didn't work. The click on the entire symbol as per my original block of code did. Just the sym.getSymbol("taboption1").click(function(){
The final syntax that worked at getting the data object from the JSON was as follows. The only difference was I removed the ''s inside the " that were in your text.
window.open(""+data[0].thelink+"", "_parent");
Thanks so much for your help! Much appreciated.





