c# - Can javascript methods of a aspx page can be included in another aspx -
javascript methods of aspx page
function somefunction(){ $.ajax({ async: false, type: 'get', data: { "userid": userid }, url: 'somehelpercode.ashx?surveys=' + "", success: display }); } aspx page can included in aspx?
somehelpercode.ashx:
public void processrequest(httpcontext context) { if(context.request.querystring.allkeys.contains("surveys")){ javascriptserializer jss = new javascriptserializer(); string serialized; //..... serialize object..... context.response.contenttype = "text/html"; context.response.write(serialized); } }
keep javascript methods in .js file. reference js file in aspx
<script type="text/javascript" src="myjsfile.js"></script>
Comments
Post a Comment