Pavlos1316 Posted April 15, 2011 Share Posted April 15, 2011 Hello, ( Iam not very familiar with javascript) On my factions.php file I have this line of code that works fine: $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; but I want to transform it to: $output[] = '<td><a href="javascript:ajaxpage('cart.php?action=delete&id='.$id.'', 'content');" class="bttn">Remove</a></td>'; but I get Unexpected T_String error. My Javascript code that makes <a href="javascript:ajaxpage....</a> to work in every other page is on top of my index.php Thank you Link to comment https://forums.phpfreaks.com/topic/233835-unexpectet-t_string/ Share on other sites More sharing options...
Maq Posted April 15, 2011 Share Posted April 15, 2011 Unless you're actually breaking out of the master string, you need to escape the single quotes. Link to comment https://forums.phpfreaks.com/topic/233835-unexpectet-t_string/#findComment-1202119 Share on other sites More sharing options...
Pavlos1316 Posted April 15, 2011 Author Share Posted April 15, 2011 Perfect... This is now working $output[] = '<td><a href="javascript:ajaxpage(\'cart.php?action=delete&id=\'.$id.\'\', \'content\');\" class="text">Remove</a></td>'; Thank you... I get no more the error BUT now my Remove button isn't working. Any ideas? Link to comment https://forums.phpfreaks.com/topic/233835-unexpectet-t_string/#findComment-1202122 Share on other sites More sharing options...
Pavlos1316 Posted April 15, 2011 Author Share Posted April 15, 2011 Ah... I accidentaly escaped all single quotes... I left '.$id.' untouched and is now working. Link to comment https://forums.phpfreaks.com/topic/233835-unexpectet-t_string/#findComment-1202129 Share on other sites More sharing options...
Pavlos1316 Posted April 15, 2011 Author Share Posted April 15, 2011 Something else.... When clicking the Remove button $output[] = '<td><a href="javascript:ajaxpage(\'cart.php?action=delete&id='.$id.'\', \'content\');\" class="r">Remove</a></td>'; I need to Refresh my Header also. How is this done? Thank you. Link to comment https://forums.phpfreaks.com/topic/233835-unexpectet-t_string/#findComment-1202132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.