通过AJAX调用Web服务 [英] Calling Webservice through AJAX

查看:432
本文介绍了通过AJAX调用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


下面的代码即时通讯在我的解决方案中使用,但是当我在ajax调用中传递数据"参数时,即时通讯收到错误,但没有数据"参数,则工作正常.

谁能告诉我this.quick的反应出了什么问题.


var strInput =";
var strSearchType = $(''#ddnSearchType'').val();

strInput = strInput +''strSearch'':''" + strSearchType +''";

disableButtons();

//清除以前的结果
$("table#tblInfo tbody tr").remove();

//对JSON的Ajax调用
$ .ajax({
类型:"POST",
contentType:"application/json; charset = utf-8",
网址:"widgetJosn.asmx/PerformSearch",
数据:"{" + strInput +}",
dataType:"JSON",
成功:parseData,
错误:AjaxFailed
});

Hi,
the below code im using in my solution, but when i pass ''data'' parameter in ajax calling, im getting the error but without ''data'' parameter it''s working fine.

can anyone tell me whats wrong with this.quick response appreciated.


var strInput="";
var strSearchType=$(''#ddnSearchType'').val();

strInput = strInput +"''strSearch'':''"+strSearchType+"''";

disableButtons();

//Clear previous results
$("table#tblInfo tbody tr").remove();

//Ajax Call to JSON
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: ''widgetJosn.asmx/PerformSearch'',
data: "{"+strInput+"}",
dataType: "JSON",
success: parseData,
error: AjaxFailed
});

推荐答案

(''#ddnSearchType'').val();

strInput = strInput +''strSearch'':''" + strSearchType +''";

disableButtons();

//清除先前的结果
(''#ddnSearchType'').val();

strInput = strInput +"''strSearch'':''"+strSearchType+"''";

disableButtons();

//Clear previous results


("table#tblInfo tbody tr").remove();

//Ajax调用JSON
("table#tblInfo tbody tr").remove();

//Ajax Call to JSON


.ajax({
类型:"POST",
contentType:"application/json; charset = utf-8",
网址:"widgetJosn.asmx/PerformSearch",
数据:"{" + strInput +}",
dataType:"JSON",
成功:parseData,
错误:AjaxFailed
});
.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: ''widgetJosn.asmx/PerformSearch'',
data: "{"+strInput+"}",
dataType: "JSON",
success: parseData,
error: AjaxFailed
});


这篇关于通过AJAX调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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