I'm trying to update my page dynamically using ajax and php. The ajax call works fine until I put it within a click() function. The alert works ok
$(document).ready(function(){
$("#formbutton").click(function(){
alert("test");
$.ajax({
url: 'url.php',
type: 'GET',
dataType: 'html',
success: function (data) {
$("#response").html(data);
}
});
});
});
This works fine in debugging:
$(document).ready(function(){
alert("test");
$.ajax({
url: 'url.php',
type: 'GET',
dataType: 'html',
success: function (data) {
$("#response").html(data);
}
});
});
What am I doing wrong? Thanks