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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.