我正在处理此代码并使用"匹配"功能来检测密码的强度.如何检测字符串中是否包含特殊字符?
if(password.match(/[a-z]+/)) score++;
if(password.match(/[A-Z]+/)) score++;
if(password.match(/[0-9]+/)) score++;
Run Code Online (Sandbox Code Playgroud) 我正在尝试从 PHP 脚本返回一个 json 编码的字符串。
$.post("order.php", { product: product_id, coupon: coupon },
function(data) {
$("#price").html("$" + data.price);
$("#discount").html("$" + data.discount);
$("#total").html("$" + data.total);
});
Run Code Online (Sandbox Code Playgroud)
我尝试在回调中使用警报函数来查看 PHP 的返回值:
{"price":249,"discount":"0.00","total":249}
Run Code Online (Sandbox Code Playgroud)
但是#price 和rest 元素的值是“$undefined”。
请帮忙。