zoukankan      html  css  js  c++  java
  • JavaScript Eval 函数使用

    值得注意的

    当传入是Json类型的时候要var user = eval(result.d);

    当传入是字符串的时候要用eval("exception = "+result.responseText);

          $.ajax
          (
          {
            type: 
    "POST",  
            contentType: 
    "application/json"
            url: serviceURL
    +"/UserLogin"
            data: 
    "{UserLoginID:'"+$('#txtLoginID').val()+"',UserLoginPW:'"+$('#txtLoginPW').val()+"'}",      
            dataType: 
    'json',
            success: 
    function(result) 
            {
                
    var user = eval(result.d);
                
    //eval("user="+result.d);
              location.href = "Welcome.aspx?userID="+user.UserID     
             },
             error: 
    function(result, status) 
             {
                 
    if(status == 'timeout'
                 {
                     alert(
    "The request timed out, please resubmit"); 
                 }
                 
    else
                 {
                     eval(
    "exception = "+result.responseText);
                     
    //var exception = eval(result.responseText);
                alert(exception.Message);
              }
            }
          }
          );
  • 相关阅读:
    ural(Timus) 1346. Intervals of Monotonicity
    SGU 223 Little Kings
    poj 1243 One Person
    poj 1185 炮兵布阵
    poj 1191 棋盘分割
    poj 1187 陨石的秘密
    ACMICPC Live Archive 2451 Brackets Sequence
    将时间格式的字符串转换成日期类型浏览器兼容解决方案
    asp.net项目发布容易忽略的debug=true
    使用微软的Ajax控件遇到的后台js提示语句不起作用的解决方案其一
  • 原文地址:https://www.cnblogs.com/xh831213/p/1692634.html
Copyright © 2011-2022 走看看