I am debugging this function in javascript which refuses to run
<script type = "text/javascript">
<!--
function sayHello() {
//alert("Hello there");
$.ajax({
url: 'frmID.aspx',
type: 'POST',
data: JSON.stringify({
name: $('#name').val(),
surname: $('#surname').val()
}),
contentType: "application/json",
dataType: 'json',
success: function (json) {
if (json['error']) {
$('#alertinfo').html('<i class="fa fa-info-circle"></i>' + json['error']);
}
else if (json['success']) {
$('#id').val(json['success']);
}
}
});
}
//-->
if i remove comments from alert function it executes. I have tried using double quotes as "post" post in upper and lower case wrapped function inside $(document).ready(function () { } but $.ajax({... part fails to run.
Pls give some clue
Thanks
You have a HTML comment in the tag. Remove <!-- or add a closing tag