aspx页面的javascript方法
function Somefunction(){
$.ajax({
async: false,
type: 'GET',
data: { "UserID": userID },
url: 'SomeHelperCode.ashx?Surveys=' + "",
success: display
});
}
aspx页面可以包含在另一个aspx中吗?
SomeHelperCode.ashx:
public void ProcessRequest(HttpContext context) {
if(context.Request.QueryString.AllKeys.Contains("Surveys")){
JavaScriptSerializer jss = new JavaScriptSerializer();
string serialized;
//..... serialize an object.....
context.Response.ContentType = "text/html";
context.Response.Write(serialized);
}
}
答案 0 :(得分:2)
将您的javascript方法保存在.JS文件中。然后在ASPX中引用JS文件
<script type="text/javascript" src="myJSFile.js"></script>