URL中文参数,JSON转换,PHP赋值JS
var jsonProps = { "dispMode":dispMode, "autoRun":autoRun, "clientPath":encodeURI(clientPath), "remark":encodeURI(remark) }; $.ajax({ url:"./process/writeTask.php", data:"proType=setTask&taskId=" + taskId + "&props=" + JSON.stringify(jsonProps),
$props = json_decode(str_replace("\\", "\\\\", urldecode($_REQUEST['props'])), true);// 注意JSON处理\需要转义一下
var oldClientPath = '<?php echo str_replace("\\", "\\\\", $clientPath); ?>'; // 如果$clientPath含有\,需要转义