Answer the question
In order to leave comments, you need to log in
How to pass a variable to the server using JS?
There is such a function.
<script type="text/javascript">
function update_rating(id)
{
alert(id)
}
</script>
<button class="btn btn-primary" onclick="update_rating({{ comment.id }})">Try it</button>
Answer the question
In order to leave comments, you need to log in
$.ajax({
url: '/path/to/file',
type: 'default GET (Other values: POST)',
dataType: 'default: Intelligent Guess (Other values: xml, json, script, or html)',
data: {param1: 'value1'},
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question