为什么onclick执行不起作用?

这段代码无法正常工作,你能发现问题吗?

    $('#button').click(function(){
   $.ajax({
      type: 'POST',
      url: 'action.php'
      }
   });
});

提前感谢你的帮助!

You have an unmatched }

$('#button').click(function(){
   $.ajax({
      type: 'POST',
      url: 'action.php'
      // } <--- Not necessary
   });
});

Change it to this:

$('#button').click(function(){
   $.ajax({
      type: 'POST',
      url: 'action.php'
   });
});

Notice that you had an extra }

This is easier:

$('#button').click(function(){
    $.post("test.php");
});