asp.net页面方法返回undefined [英] asp.net page methods returning undefined

查看:921
本文介绍了asp.net页面方法返回undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用页面方法在我的asp.net页面。我必须使设置为true在脚本管理器页面方法,在方法定义的WebMethod属性,功能是公共静态字符串,我知道该功能的工作,因为当我从我的code运行它背后产生预期的结果,但是当我在我的结果通过功能页面方法调用它的结果总是提醒为未定义。如果我使用Fiddler它甚至不看起来像有额外的流量或创建一个新的请求。我运行在端口82的网站,如果有差别。我在这里的损失。有人可以给我一些指点?

I am trying to use page methods in my asp.net page. I have enable page methods set to true on the script manager, the webmethod attribute defined on the method, the function is public static string, I know the function works because when I run it from my code behind it generates the expected result, but when I call it via page method in my result function the result is always alerted as undefined. If I use fiddler it doesn't even look like there is additional traffic or a new request created. I'm running the site on port 82 if that makes a difference. I'm at a loss here. Can someone give me some pointers?

推荐答案

在您PagesMethods来电,从回调和错误函数删除括号:

In your PagesMethods call, remove the parentheses from the callback and error functions:

PageMethods.getAdCodeInfo(value, onSuccess, onError)

的onSuccess 的onError 基本上是指向函数的变量。所以,你不需要括号的变量名。

onSuccess and onError are basically variables that point to the functions. So you don't need parentheses for variable names.

这篇关于asp.net页面方法返回undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆