在XMLHttpRequest中调用storedProcedure

时间:2016-03-14 10:39:56

标签: web-services function xmlhttprequest

这是我的webService。输入procedureName并调用invoke按钮后,我得到了攻击。

如何调用此webService并在XMLHttpRequest中输入参数名称storedProcedure?

我试试

var procNameVal = 'Execute cityReturn';

                var url = "../webService/myService.asmx/myServiceDB?callback=?userName=test&callback=test&procedureName=";
                url += procNameVal;

但没有工作!

<script type="text/javascript" language="javascript">
    var myReq = new XMLHttpRequest();
    function callWSMethod1()
    {


        if (window.XMLHttpRequest)
            {
                var url = "../webService/myService.asmx/myServiceDB; //???
                myReq.onreadystatechange = CheckStatus1;
                myReq.open("GET", url, true); // true indicates asynchronous request
                myReq.send();

            }
    }
    function CheckStatus1()
    {

        if (myReq.readyState == 4) // Completed operation
        {
           alert("yes");
        }
        else
        {
            alert("error");
        }

    }
    </script>

1 个答案:

答案 0 :(得分:0)

var par1 = '1';
var par2 = '2';

var url = "..webService/myService.asmx/myServiceDB?userName=par1&callback=par2&procedureName="
                + document.getElementById("myProc").value;