I am making a website in which I need to make a ajax call. but the problem is that, ajax call is working only once. Once it complete one call then there is no effect of clicking button which triggers that call
my java script is
<script>
$(document).ready(function () {
$("#submit1222").on('click', function () {
var name = $("#name1222").val();
var dataString = 'filter=' + name;
if (name == '') {
document.getElementById('error1').innerHTML = "Please Fill All Fields";
} else {
$.ajax({
type: "POST",
url: '<?php echo $action; ?>',
data: dataString,
cache: false,
success: function (result) {
document.getElementById('container').innerHTML = result;
}
});
}
return false;
});
});
</script>
and html is
<input type='text' id='name1222'>
<input type="submit" id="submit1222">
please tell me where i am making mistake.