How Ajax was submitted to the background

We do before and after the interaction, it may relate to the time of submission, receiving back-end data model time data type is Date type, so we have to give back-end pass to type Date, but user-friendly, and we tend to show the acquired data is formatted time format.

Model class:

Ajax transmission format:

  $.ajax({
            type: "post",
            contentType: "application/x-www-form-urlencoded",
            url: "/api/v1/****",
            data: {

                "ftime": new Date(ftime),
                "title": title,
                "content": content,
                "ltime":  new Date(ltime),

            },
            dataType: "json",
            success: function (data) {
                if (data.resultTypeEnum == 200) {
                    layer.msg(data.message, {icon: 1})
                    clearhomework();
                } else {
                    layer.msg(data.message, {icon: 2})
                }
            }
        });

Here to do a simple operation, the time is then transferred to a Date type.

 

Published 67 original articles · won praise 139 · Views 140,000 +

Guess you like

Origin blog.csdn.net/qq_37857921/article/details/104892681