我有一些JavaScript問題。我從數據庫中獲取編碼的字符串並放入它的javascript數組。字符串包含\\並且當我警告字符串長度比它有更大。我如何獲得原始字符串? 這是我的字符串如何獲得編碼的字符串原始長度包含\字符在JavaScript中,jQuery的?
var a = "[email protected][email protected]~_Gf}\\|[email protected]@ilDvi][email protected]@[email protected]`@`vIlrZznB`d^[email protected]@~bK~yT~uQxsPpmA|wL_bD|[email protected]`[email protected]@u`Erw~Am|Dp{[email protected]}[email protected]@feAziLrwFhJl}Ax`LvwHz||@[email protected]@_D~j}@[email protected]_GjfuAlj]t_`@`[email protected]{\\|AbxOj}LnxK`fN|gXtyH~cBrvElnKhaPxk`@jxB~v\\[email protected]~|[email protected]@[email protected]_QprrAcaC|[email protected]`@[email protected]|opB}[email protected]`pdAjlIx|[email protected]@l`[email protected]|y\\v{`@[email protected][email protected][email protected]]|hJxzU|~AflJvyDncJpnJdkKabBn`ToeE|[email protected]{NraHvkKnfCv}Js`@pmRx}EroV`dItwQnpQlcM~jAzrGikJdaHujMjxJs`@bxQzsEjlKmyCnrJc|FzrXu`FzhJ`eE`|LvfD`}`@[email protected]`[rzL~rwAtfDbhTn|HvvKluRvqWjiNxjHnlE|@[email protected]@oFnxRigF|nO{[email protected]@[email protected]}[email protected]{AnwZvZh{[email protected][email protected]|AfmOj|FvlYzvE|[email protected]{[email protected]@[email protected]~AhyJorBzaOu|AffTpzFnaLv_W`{[email protected]~`KvuJ`[email protected]`eI~vV`yFv`[email protected]~iHtiH`[email protected]`tYv~Vlf^[email protected]@p|Rxp[[email protected]|[email protected]`|[email protected]~cIp}MjyUzuC|{O`[email protected]|[email protected]~mS|[email protected][email protected]|uSpkOrqHldHhkHl|Kjk[[email protected]@beVh|LnrJw}@~yRdk`@hhsAf~RtwSnbRblZp|CtgZfs]radA~~Bf_[[email protected]|[email protected]\\blEluFpuFmsDn|FaoCdwCqlB~hFb|D|nMthQl_FfvFsxA|tYl|[email protected]@x]xP"
alert(a.length) //length is 1279
$.ajax({
cache : false,
url : 'get_polylines.action',
type : 'post',
dataType : 'json',
async : false,
success : function(result) {
var polyline = result.polyline;
var arr = new Array();
var k = 0;
for (var j = 0; j < polyline.length; j++) {
arr [k] = polyline[j];
k++;
}
for(var i=0; i<arr.length; i++){
alert(arr[i].length); //length is 1284
}
},
});
,當我把這個字符串輸入hiiden申請,然後獲得價值也提醒長度1284
'arr [i] .length'會拋出異常。 –
但是'arr'在您嘗試查找其長度時沒有看到任何內容..? –
我在數組中只寫了一個值 – Lusi