Jquery $ajax callback post

  • 436
  • 0

Jquery $ajax callback post

 

<script type="text/javascript">
    var Url_del_ApplyListInsertSuccess = '@Url.Action("del", "ApplyListInsertSuccess")';
    var Url_index_SearchData  = '@Url.Action("index", "SearchData")';
</script>
        var apply_id = $("#htm_apply_id").html();
        $.ajax({
            type: "POST",
            url: Url_del_ApplyListInsertSuccess,
            contentType: "application/json",
            data: JSON.stringify({
                'apply_id': apply_id
            }),
            success: function () {
                alert("刪除成功");
                $("#dialog_del").dialog("destroy");
                //var input_data = '<input type="hidden" name="apply_id" value="' + obj.apply_id + '">';
                $('<form action="' + Url_index_SearchData + '" method="POST"></form>').appendTo('body').submit();
            },
            error: function () {
                alert("刪除失敗");
                //console.log("error");
            }
        })