You're missing a
.
- it's
$.ajax
, not
$ajax
:
jQuery.ajax() | jQuery API Documentation[
^]
You're also missing a
$
in your "success" callback.
$(document).ready(function(){
$("button").click(function(){
$.ajax({
type: 'GET',
url: '@Url.Action("HelloAjax", "Home")',
success: function(result){
$("#div1").html(result);
}
});
});
});
If that doesn't fix it, then you'll need to tell us what the error is. Open your browser's developer tools by pressing
F12, and check the console for errors. Most browsers will also give you the option to examine any network requests made from the page, which will let you see the AJAX request and response, in case there's a server error.