I am using the following code in index.html
<html>
<head>
<title>Ajax check</title>
<script type="text/javascript" src="jquery-1.8.3.min.js" />
<script type="text/javascript">
$(document).ready(function(){
alert('working...');
$('#ibutton').click(function(e){
e.preventDefault();
alert('double click');
$.ajax({
url: "page.html",
cache: false,
success: function(){
$("#message").val('ajax working..');
},
error: function(){
$("#message").val('error in the page');
}
});
});
});
</script>
</head>
<body>
<form action="page.html">
<input type="button" id="ibutton" value="click here"/>
<div id="message"></div>
</form>
</body>
</html>
In page.html, the only content is 'working...'
when I click the click here button... nothing happens.. what is wrong in the code?
click herebutton.. nothing happerns' it is rectified by changing<script type="text/javascript" src="jquery-1.8.3.min.js" > </script>instead of<script type="text/javascript" src="jquery-1.8.3.min.js" />.. and using $(#message).text('ajax working..') instead of $(#message).val('ajax working..') , script works fine and shows 'error in page'.. please rectify why it is displaying error?