So I have this:
<?php
echo '
<script>
$(function(){
$("a#yeah").click(function(){
$.ajax({
url: "ajax.php?action=yeah&id='.$id.'",
success: function(html){
$("a#yeah").html("your cool")
}
})
})
})</script>';
?>
basically I am using the PHP variable $id which can be find in the document, how could I get this same variable but without echoing the jQuery(so I could keep my editor syntax highlight in the JavaScript part)?
never echo any client side code – just type it as is.
PHP especially good in this http://www.php.net/manual/en/language.basic-syntax.phpmode.php