Jquery ajax 访问调用带参数的服务方法!

页面脚本中的写法:

$.ajax({url: "http://localhost:3510/WebSite/WebService/ExceptionRecoder.asmx/SetExceptionInfo",contentType: "application/json; charset=utf-8",                  type: "POST",                  dataType: "json",                  data: "{mStrException:'"+ e +"'}",success: function (json) { alert(json.d); }});

服务写法: 

[System.Web.Script.Services.ScriptService]
public class ExceptionRecoder  : System.Web.Services.WebService 
{/// <summary>/// 记录前台传入的信息/// </summary>/// <param name="ex">异常类内容</param>/// <returns></returns>[WebMethod(EnableSession = true)]public string SetExceptionInfo(string mStrException){string errorMethod = null;string remark ="";LogHelper.Instance().WriteErrorLog(BizLogEnum.SystemError.ToString(), mStrException, mStrException,null, errorMethod, remark);return "true";}
}

注意:当前台调用不到带参数的服务时,一般有这两种原因:1可能是因为你前台传参数时候data:拼接参数值不对  2可能是因为服务里面

“//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 [System.Web.Script.Services.ScriptService]”这句话可能被注销掉了。

转载于:https://www.cnblogs.com/BeyondWJsel/archive/2012/04/20/2459330.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/274862.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

requests模块发送带headers的Get请求和带参数的请求

1.在PyCharm开发工具中新建try_params.py文件&#xff1b; 2.try_params.py文件中编写代码&#xff1a; import requests#设置请求Headers头部header {"User-Agent" : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;"}#请求输入参数p…

面试官问:跨域请求如何携带cookie?

大家好&#xff0c;我是若‍川。持续组织了6个月源码共读活动&#xff0c;感兴趣的可以点此加我微信 ruochuan12 参与&#xff0c;每周大家一起学习200行左右的源码&#xff0c;共同进步。同时极力推荐订阅我写的《学习源码整体架构系列》 包含20余篇源码文章。历史面试系列本文…

Method not found: '!!0[] System.Array.Empty()'.

一开始不知道啥情况&#xff0c;原来是自己把.net 框架改成4.6.1了&#xff0c;客户机是4.0 so.... 把项目改低点&#xff0c;就ok了。转载于:https://www.cnblogs.com/ZaraNet/p/11100207.html

记录点滴8

第8~9周 4月7日~4月22日 第八周的时候实在太多东西要做了&#xff0c;我把写周记这件事给忘了&#xff0c;其实也没太大关系&#xff0c;写跟不写之间也没有太大的鸿沟&#xff0c;只是写了之后&#xff0c;会让我的记忆更加清晰&#xff0c;让自己明白&#xff0c;最近自己做了…

ux设计中的各种地图_移动应用程序设计中的常见UX错误

ux设计中的各种地图Have you ever tried a new app, only to realize you have no idea how to use it?您是否曾经尝试过一个新的应用程序&#xff0c;却发现自己不知道如何使用它&#xff1f; Few things can transport a person from calm and happy, to frustrated and an…

如何使用 Node 后端创建 React 应用程序:完整指南

大家好&#xff0c;我是若川。持续组织了6个月源码共读活动&#xff0c;感兴趣的可以点此加我微信 ruochuan12 参与&#xff0c;每周大家一起学习200行左右的源码&#xff0c;共同进步。同时极力推荐订阅我写的《学习源码整体架构系列》 包含20余篇源码文章。历史面试系列React…

FP error code老是忘记的看这里:只给出最常用的几个。

把常见的几个记牢&#xff0c;不要在比赛时纠结。 错误2&#xff1a;输入文件未找到。 错误106&#xff1a;数据读入的格式错误&#xff0c;往往是读入语句出错。 错误200&#xff1a;被零除。 错误201&#xff1a;范围检查错误&#xff0c;数组越界。 错误202&#xff1a;栈溢…

快速求幂算法

1 #include <stdio.h>2 #include <math.h>3 //递归算法4 int recursion(int a,int b)5 {6 int tem 1;7 if(b0)return 1;8 else if(b1)return a;9 tem recursion(a,b>>1); 10 tem tem*tem; 11 if(b&1) tem tem * a; 12 r…

工业仪器仪表 界面设计_如何设计时尚的仪表板界面

工业仪器仪表 界面设计重点 (Top highlight)Welcome to the second step by step UI guide. Since you really liked my first article on “How to achieve Friendly, Lightweight UI”, I decided to make another one in a similar manner. Please note, that this is not a…

linux ifconfig命令参数及用法详解--linux查看配置网卡命令

ifconfig 是一个用来查看、配置、启用或禁用网络接口的工具&#xff0c;这个工具极为常用的。可以用这个工具来临时性的配置网卡的IP地址、掩码、广播地址、网关等。也可以把 它写入一个文件中&#xff08;比如/etc/rc.d/rc.local)&#xff0c;这样系统引导后&#xff0c;会读取…

给3月要跳槽的前端提个醒!不了解微前端就别去面试了,不然……

在后端架构发展史上&#xff0c;如果要找一个低耦合高内聚架构模式的典范&#xff0c;微服务当仁不让。在互联网业务急速扩张的背景下&#xff0c;微服务架构解决了后端服务中的“重”&#xff0c;让每个服务都能够独立部署、独立扩展&#xff0c;每个服务都具有稳固的模块边界…

调试 SharePoint 解决方案

调试 SharePoint 解决方案 可以使用 Visual Studio 调试器来调试 SharePoint 解决方案。 启动调试后&#xff0c;Visual Studio 会将项目文件部署到 SharePoint Server&#xff0c;然后在Web 浏览器中打开 SharePoint 网站的一个实例。 以下各节说明如何在 Visual Studio 中调试…

ui和ux的区别_UI和UX之间的区别

ui和ux的区别You’ve probably heard a lot of self-proclaimed “UX/UI” designers out there, the word “UI” thrown around endlessly at Apple keynotes, or tech startups saying “we need to fix the UX here and the UX there.”Ÿouve可能听说过很多自称“UX / UI”…

给UIWebView增加搜索栏

在xib文件中拖入UIWebView。使用代码为UIWebView的滚动控件增加搜索栏&#xff1a;UISearchBar* searchBar[[[UISearchBar alloc]initWithFrame:CGRectMake(0, -44, 320, 44)]autorelease];[self.browser.scrollView addSubview:searchBar];self.topBarsearchBar;[[self.browse…

用JS轻松实现一个录音、录像、录屏工具库

大家好&#xff0c;我是若川。持续组织了6个月源码共读活动&#xff0c;感兴趣的可以点此加我微信 ruochuan12 参与&#xff0c;每周大家一起学习200行左右的源码&#xff0c;共同进步。同时极力推荐订阅我写的《学习源码整体架构系列》 包含20余篇源码文章。历史面试系列前言最…

文本字段和表单设计-UI组件系列

重点 (Top highlight)Forms have existed for a significant amount of time, greatly simplifying the task of drafting complaints and various other legal pleadings. With the advance of information and its processing, means to gather the data are also evolving. …

WCF 第四章 绑定 netMsmqBinding

MSMQ 为使用队列创建分布式应用程序提供支持。WCF支持将MSMQ队列作为netMsmqBinding绑定的底层传输协议的通信。 netMsmqBinding绑定允许客户端直接把消息提交到一个队列中同时服务端从队列中读取消息。客户端和服务端之间没有直接通信过程&#xff1b;因此&#xff0c;通信本 …

React 18 RC 版本发布啦,生产环境用起来!

大家好&#xff0c;我是若川。持续组织了6个月源码共读活动&#xff0c;感兴趣的可以点此加我微信 ruochuan12 参与&#xff0c;每周大家一起学习200行左右的源码&#xff0c;共同进步。同时极力推荐订阅我写的《学习源码整体架构系列》 包含20余篇源码文章。历史面试系列今天给…

阿拉伯语排版设计_针对说阿拉伯语的用户的测试和设计

阿拉伯语排版设计Let me start off with some data to put things into perspective “Why?”让我从一些数据入手&#xff0c;以透视“为什么&#xff1f;”的观点。 Arabic is the 5th most spoken language worldwide, with 420 million speakers, and is an official lang…

CMMI简介

CMMI&#xff08;Capability Maturity Model Integration&#xff09;即能力成熟度模型集成 什么是CMMI CMMI是CMM模型的最新版本。早期的CMMI&#xff08;CMMI-SE/SW/IPPD&#xff09;1.02版本是应用于软件业项目的管理方法&#xff0c;SEI在部分国家和地区开始推广和试用。随…