Jump to content

[SOLVED] Strange Syntax Error


Ninjakreborn

Recommended Posts

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

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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.