如何从json.stringfy中选择字符串 [英] how to select string from json.stringfy
本文介绍了如何从json.stringfy中选择字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.
我有jquery函数,运行成功,什么问题是,当我尝试从此方法中获取字符串时,它将无法定义.但是当我使用json.stringfy时,reslut来了:{"d":"epension"}
我只想将epension作为字符串使用.
这是代码:
hi to all.
i have jquery function, that running successfully, what problem is that when i am trying to fetch string from this method it will come undefine. but when i use json.stringfy the reslut is coming : {"d":"epension"}
i want to user only epension as a string.
here is code :
function testdata() {
$.ajax({
type: "Post",
url: "http://localhost:49410/code/Home.aspx/test",
data: '{}',
contentType: "application/json; charset=utf-8", // content type sent to server
datatype: 'json',
success: function (response) {
$('#tableContent').html(response);
},
failure: function (response) {
alert(json.stringfy(response));
}
});
}
推荐答案
.ajax({ 类型:" , url:" , 数据:' {}', contentType:" ,发送到服务器的内容类型 数据类型:' json', 成功:功能(响应){
.ajax({ type: "Post", url: "http://localhost:49410/code/Home.aspx/test", data: '{}', contentType: "application/json; charset=utf-8", // content type sent to server datatype: 'json', success: function (response) {
(' #tableContent').html(响应); }, 失败:功能(响应){ alert(json.stringfy(response)); } }); }
('#tableContent').html(response); }, failure: function (response) { alert(json.stringfy(response)); } }); }
所以只需更改为:
So just change to:
这篇关于如何从json.stringfy中选择字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文