我有一个发出AJAX请求并返回一些数据的函数:
private Dictionary<string, string> _listOfString = new Dictionary<string, string>
{
{"0", "TextToDisplay" }
};
public Dictionary<string, string> ListOfString
{
get
{
return _listOfString;
}
set
{
if (_listOfString.Equals(value))
{
return;
}
_listOfString = value;
}
}
显示时,显示为$(document).ready(function(){
$("select#test").change(function(){
$.ajax({
url: "",
data: { "value": $("#test").val(),
csrfmiddlewaretoken: '{{ csrf_token }}'},
dataType:"json",
success: function(data){
$("div#return").text(data)
}
});
});
});
。我想在控制台中访问它,但当我加载控制台并输入[object Object]
时,它会告诉我data
从我的Django视图返回数据,Uncaught ReferenceError: data is not defined(...)
是一个JSON对象,如下所示:
data
答案 0 :(得分:2)
success: function(data){
console.log(data);
}
答案 1 :(得分:0)
我只想添加一个断点:
do {
input = scan.nextInt();
//calculates the total number of even integers
if (input%2 != 1)
{
numeven = numeven+1;
}
} while (input != 0);