繁体   English   中英

jQuery.Ajax发布到Web服务

[英]jQuery.Ajax Post to webservice

我需要将数据发布到后端系统(SAP)。 我正在尝试使用以下代码:

硬编码URL示例:

  var dataString = ""
    //Add TO SAP.
     var aData =  
            jQuery.ajax({
                type: "POST",
                //contentType: "application/xml",
                url: "http://delyo001.you.local:8000/sap/bc/youconsulting/ws/rest/anonymous/z_names_post?firstname=testz&lastname=zefzef",  // for different servers cross-domain restrictions need to be handled
                data: dataString,
                //dataType: "json"

                success: function(xml) { // callback called when data is received
                    //oModel.setData(data);             // fill the received data into the JSONModel
                    alert("success to post");
                },

                error: function(xml) { // callback called when data is received
                    //oModel.setData(data);             // fill the received data into the JSONModel
                    alert("fail to  post");
                    alert(xml);
                }
            });

该Web服务通过SOAPUI工作。 但不是通过这种方式。

任何人都可以指导此代码出了什么问题。

此致Vincent

尝试将标头设置为:

标头:{“ Content-Type”:“ application / x-www-form-urlencoded”}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM