Invoking ASP.NET codebehind method from JavaScript

后端 未结 4 886
悲&欢浪女
悲&欢浪女 2021-01-29 05:25

Can someone please tell me how I can invoke a ASP.NET codebehind method from client-side JavaScript?

Thanks

4条回答
  •  北海茫月
    2021-01-29 05:43

    Use jQuery AJAX , This is good source

    $.ajax({
      type: "POST",
      url: "MessagePopup.asmx/SendMessage",
      data: "{subject:'" + subject + "',message:'" + message + ",messageId:'" + messageId + "',pupilId:'" + pupilId +"'}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Do something interesting here.
      }
    });
    

    If you want just using JavaSctipt without using jQuery fallow this links

提交回复
热议问题