Home > Web Front-end > JS Tutorial > JavaScript Eval function usage_javascript tips

JavaScript Eval function usage_javascript tips

WBOY
Release: 2016-05-16 18:31:28
Original
1045 people have browsed it

It is worth noting
When the input is a Json type, var user = eval(result.d);
When the input is a string, use eval("exception = " result.responseText);

Copy code The code is as follows: > 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); 🎜>     }
   }
   }
   );

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template