后台中:
JSONObject js = new JSONObject();
js.accumulate("jStr",jStr[0]); //已经获得 jStr[0] 的值。
response.getWriter().write(js.toString());
msg="{\"result\":\"true\", \"msg\":\"CanColVideo\"}";
out.print(msg);
out.flush();
前台js中:
$.ajax({
url:aurl,
type:'POST',
data:adate,
dataType : "json",
async:false,
success:function(data)
{
if(data.msg=="colVideo")
{
$('#'+noColId).empty();
$('#'+ColId).css("display","block");
}
if(data.msg=="CanColVideo")
{
data = eval("("+data+")");
alert(data.jStr); // 怎么获得jStr[0]的值啊。。为什么老是跳object object
}
else if(data.msg=="fail")
{
window.open("请登录!");
}
},
error:function(response)
{
alert("111111");
},
});