Ajax post requests an object of xml, which cannot be sent to the backend to report an error.

For the

ajax Post request, the backend accepts the string type. The object can send a json message successfully, but send an error
request: obj.request. The request backend receives the string type. The foreground obj.request is json, but an error is reported when the xml message is sent. Would you please help me to see how to solve it?

SaveInterface: function () {

            var obj = this.template;
            console.log(obj.requestType);
            console.log(obj.request);
            if (obj.interfacename == "" || obj.request == "") {
                alert("Request");
            }
            else {
                var $promise = $.ajax({
                    url: "@Url.Action("CreateInterface")",
                    type: "post",
                    dataType: "json",
                    data: { serviceName: obj.ServiceName, interfaceName: obj.interfacename, requestType: obj.requestType, request: obj.request }
                });
                $promise.done(function (result) {
                    if (result.isSuccess) {
                        alert("");
                        //
                        vm.interfaceNames.push(obj.interfacename);
                        art.dialog.opener.art.dialog.list["Addinterface"].close();
                    }
                    else {
                        alert("");
                    }
                });
Mar.28,2021

The dataType of the ajax of

jQuery refers to the data type returned, not the requested data type.

if you want to transfer the XML type, you need to set contentType and you want to build the xml data yourself, api will not automatically generate the xml

for you.

I wonder if that's what you're talking about

.

Hello, I don't know if this will help you AJAX uses post to send data in xml format to accept data


ajax first specify the datatype type as xml, dynamically generated XML must be set to text/xml, otherwise the default is text/html that is plain text. Then according to the root node to get the child node data
for reference only http://www.cnblogs.com/mslove.


Thank you for your advice, I have solved it.
the problem is that there is a url, in the XMl, so you need to encrypt the request under, encodeURIComponent (obj.request), then pass it to the background and decrypt it: HttpUtility.UrlDecode (), is solved.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e88a7a-ef2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e88a7a-ef2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?