Nov Esk Eduard Nov Esk Eduard - 1 year ago 97
Javascript Question

token illegal; PHP inside javacript code

i use php in my javascript code to print a javascript line but i have an error, what am I doing wrong?? help me please

<?php if (isset($_GET['dateSelected'])) {

echo '$("#eliminarCitaBtn").attr("href", "index.php/agenda/eliminarCita/"+event.cita_id+"/?agendaId='.$_GET["agendaId"].'&dateSelected='.$_GET["dateSelected"].');';

echo "$('#eliminarCitaBtn').attr('href', 'index.php/agenda/eliminarCita/'+event.cita_id+'/?agendaId=".$_GET['agendaId'].");";


Answer Source

You are't closing the quotes at the end of either attr().

There '");'; and there "');";

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download