Want my button to do something onclick, it has the id btnSend. Nothing happens when i click the button which is wierd and I can't figure out why.

  • The script is in my view for now within script tags.

    $("#btnSend").click(function () {
        var messageInfo = {
            "Body": $("#Message").val(),
            type: "POST",
            url: '/Api/Posts',
            data: JSON.stringify(messageInfo),
            contentType: "application/json;charset=utf-8",
            processData: true,
            success: function (data, status, xhr) {
                alert("The result is : " + status);
            error: function (xhr) {

Related posts

Recent Viewed