未知的网络方法。参数名称:methodName c#

未知的网络方法。参数名称:methodName c#

问题描述:

好的我的问题是接下来,这是我的脚本...

Ok my problem is next, this is my script...

<script type="text/javascript">
        $(document).ready(function() {
            $.ajax({
                type: "POST",
                url: "Kategorije.aspx/CartState",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: { },
                success: function (msg) {
                    $("#ispis").text(msg.d);
                }
            })
        });
    </script>



和这里的方法我打电话




and here''s method i''m calling

public static int CartState()
   {
       DatabaseEntities db = new DatabaseEntities();

       var rez = from p in db.PrivremenaKorpa
                 where (p.SessionID == HttpContext.Current.Session.SessionID)
                 select p;
       return rez.Count();
   }





使用firebug和请求发生,但这是我从firebug得到的回应:





using firebug and request happens, but this is what i get as response from firebug:

Unknown web method CartState.
Parameter name: methodName



现在,我想在页面加载后调用CartState,并替换div的内容(Divispis) )使用页面方法返回。

我对此有点新,所以任何帮助都会受到赞赏。


Now, i want to call "CartState" once page is loaded, and replace the div''s content (Div "ispis") with the page method''s return.
I''m kinda new with this, so any help would be appreciated.

(document).ready(function(){
(document).ready(function() {


.ajax({
type:POST,
url:Kategorije.aspx / CartState,
contentType:application / json; charset = utf-8,
dataType:json,
data:{},
success:function(msg){
.ajax({ type: "POST", url: "Kategorije.aspx/CartState", contentType: "application/json; charset=utf-8", dataType: "json", data: { }, success: function (msg) {


(#ispis)。text(msg.d);
}
})
});
< / script >
("#ispis").text(msg.d); } }) }); </script>



和这里的方法我打电话




and here''s method i''m calling

public static int CartState()
   {
       DatabaseEntities db = new DatabaseEntities();

       var rez = from p in db.PrivremenaKorpa
                 where (p.SessionID == HttpContext.Current.Session.SessionID)
                 select p;
       return rez.Count();
   }





使用firebug和请求发生,但这是我从firebug得到的回应:





using firebug and request happens, but this is what i get as response from firebug:

Unknown web method CartState.
Parameter name: methodName



现在,我想在页面加载后调用CartState,并替换div的内容(Divispis)用页面方法返回。

我对此有点新意,所以任何帮助都会受到赞赏。


Now, i want to call "CartState" once page is loaded, and replace the div''s content (Div "ispis") with the page method''s return.
I''m kinda new with this, so any help would be appreciated.