Ninjakreborn Posted July 31, 2009 Share Posted July 31, 2009 function open_window(artist, title) { window.open("buy_pages/"+artist+"_"+title+".php", "newwin"); } $('#changing_content').html($('#changing_content').html()+'<center><a onClick="open_window("'+artist+'", "'+title+'");" href="#"><img src="image/buybutton.gif" style="border: none;" /></a><br /><br /><b>'+json.title+'</b></center>'); This should not be throwing a syntax error. This should be simply setting a function onclick for the link and then calling a function when it's clicked. Link to comment https://forums.phpfreaks.com/topic/168282-solved-strange-syntax-error/ Share on other sites More sharing options...
rhodesa Posted July 31, 2009 Share Posted July 31, 2009 without all the code, it's kind of hard to debug it. but my guess is it should be: $('#changing_content').html($('#changing_content').html()+'<center><a onClick="open_window(\''+artist+'\', \''+title+'\');" href="#"><img src="image/buybutton.gif" style="border: none;" /></a><br /><br /><b>'+json.title+'</b></center>'); also, should json.title just be title? Link to comment https://forums.phpfreaks.com/topic/168282-solved-strange-syntax-error/#findComment-887620 Share on other sites More sharing options...
haku Posted July 31, 2009 Share Posted July 31, 2009 If that doesn't fix it, try swapping the single quotes around the css selectors for double quotes. I've had troubles with jquery and single quotes in the past. Link to comment https://forums.phpfreaks.com/topic/168282-solved-strange-syntax-error/#findComment-887630 Share on other sites More sharing options...
Ninjakreborn Posted July 31, 2009 Author Share Posted July 31, 2009 Perfect a mixture of those two solutions work. And no the json.title is one variable and title is another variable. json.title was the original variable and has it's uses but I needed some slight changes for the links so I put them in title instead. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/168282-solved-strange-syntax-error/#findComment-887635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.