大哥们帮小弟我看看!eval报错
大哥们帮我看看!!!在线等!!!!!eval报错
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="./scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
function fun() {
var url = "Handler1.ashx";
var data = { imagename: "myImage" };
jQuery.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
complete: function (response) {
fun1(response);
}
});
function fun1(response) {
var dataobj = eval("(" + response + ")");
alert("TxtOrderId:" + dataobj.TxtOrderId);
}
}
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick="fun()" />
</body>
</html>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string content = String.Format("{{\"TxtOrderId\":\"{0}\",\"TxtSendTicketCityName\":\"{1}\"}}", "老虎", "老虎");
context.Response.Write(content);
}
------解决思路----------------------
就是格式问题么
耐心点检查
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="./scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
function fun() {
var url = "Handler1.ashx";
var data = { imagename: "myImage" };
jQuery.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
complete: function (response) {
fun1(response);
}
});
function fun1(response) {
var dataobj = eval("(" + response + ")");
alert("TxtOrderId:" + dataobj.TxtOrderId);
}
}
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick="fun()" />
</body>
</html>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string content = String.Format("{{\"TxtOrderId\":\"{0}\",\"TxtSendTicketCityName\":\"{1}\"}}", "老虎", "老虎");
context.Response.Write(content);
}
------解决思路----------------------
就是格式问题么
耐心点检查