There is a code, but firebug gives an error. In javascript is not strong, please help solve the problem

<html> <head> <script type="text/javascript" src="js/jquery-1.2.1.js"></script> </head> <body> <script type="text/javascript"> function post(id) $.ajax({ type: "POST", url: "ajax_send.php", data: "id=" + id, success: function (msg) { alert(msg); } }); </script> <a href="javascript:post('1');">Добавить 1</a> <a href="javascript:post('2');">Добавить 2</a> <a href="javascript:post('3');">Добавить 3</a> <a href="javascript:post('4');">Добавить 4</a> </body> </html> 

    1 answer 1

    forgot about braces

     function post(id){ $.ajax({ type: "POST", url: "ajax_send.php", data: "id=" + id, success: function (msg) { alert(msg); } }); } 
    • Yes, in the function after the condition must be braces this is a syntax error you have! - Sergey Stepanov