使用页面方法-简单问题 [英] Using Page Methods - simple question

查看:57
本文介绍了使用页面方法-简单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法通过AJAX调用c#方法,但是现在我有一个简单的疑问:

在我的.js文件中,我有:

I managed to call c# methods through AJAX, but now I have a simple doubt:

On my .js I have:

function criarNota() {

    var note_id = jQuery.fn.stickyNotes.createNote();
    alert("isto: "+note_id);
    PageMethods.criarNota(note_id,function(result) { // é enviado o ID da nota criada
                alert(result);
            });
            }




我将note_id var发送到服务器.




I send the note_id var to server.

[System.Web.Services.WebMethod]
   public static string criarNota(int note_id)
   {
       try
       {
          // receives note_id, execute sql statement and I get:

           // string text
           // int id

         

           return ...........;
       }





How can I return that text and id var and how to receive it my js function?

推荐答案

http://geekswithblogs.net/frankw/archive/2008/03/13/asp .net-ajax-callbacks-to-web-methods-in-aspx-pages.aspx [

这篇关于使用页面方法-简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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