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>';
?>
I mainly use the PHP variable $ id, which can be found in the document, how can I get the same variable but not repeat jQuery (so that I can preserve editor syntax highlighting in the Javascript part)?
source
share