Die (json_encode (. didn't return my ajax code
$.post('{:U("Safeinfo/txpassadd")}', $("#txadd").serialize(), function(data) { alert("ok");...
Php code:
Tip ("100", 'transaction password cannot be the same as logon password! ');
function tip($code, $msg) { $arr['code'] = iconv('GB2312', 'UTF-8', $code); $arr['msg'] = iconv('GB2312', 'UTF-8', $msg); //die(json_encode($arr)); die(var_json_encode($arr)); //cjq}function var_json_encode($var){ $_var = var_urlencode($var); $_str = json_encode($_var); return urldecode($_str); }
The alert ("OK") is not displayed on the result page. why is ajax not returned?
This cannot be done either:
function tip($code, $msg) { $arr['code'] = iconv('GB2312', 'UTF-8', $code); $arr['msg'] = iconv('GB2312', 'UTF-8', $msg); die(json_encode($arr,JSON_UNESCAPED_UNICODE)); //cjq}
Why?
Reply to discussion (solution)
This is not the case :(
function tip($code, $msg) { $arr['code'] = $code; $arr['msg'] = $msg; die(json_encode($arr,JSON_UNESCAPED_UNICODE)); //cjq}
$ _ Var = var_urlencode ($ var );
Where is this function defined?
$ _ Var = var_urlencode ($ var );
Where is this function defined?
/*** Encode the variable or data using urlencode, so that the encoding for json_encode is not Chinese, prevention of json_encode failure * @ access private * @ param $ var * @ return array */function var_urlencode ($ var) {if (empty ($ var) {return false ;} if (is_array ($ var) {foreach ($ var as $ k => $ v) {if (is_scalar ($ v )) {// if is used to handle situations where the array is not $ var [$ k] = urlencode ($ v );} else {// else is used to process arrays $ var [$ k] = var_urlencode ($ v );}}} else {// used to process arrays $ var = urlencode ($ var);} return $ var ;}
UTF-8 encoded
{"Code": "100", "msg": "The transaction password cannot be the same as the login password! "}
It should be other issues
Check the source file in the browser.
UTF-8 encoded
{"Code": "100", "msg": "The transaction password cannot be the same as the login password! "}
It should be other issues
Check the source file in the browser.
Page Source code:
...
- Transaction password
- For your account security, you need to enter the transaction password for withdrawal. make sure the password is different from the logon password.
- Set cancel settings
-
-
- Cancel password retrieval
...
The preceding page displays the content of safeinfo-jiaoyimima.html,
The safeinfo-jiaoyimima.html content is as follows:
Untitled Document