javascript - String replace not working? -
i've been trying replace following string using following...
var r = response.replace('var s = getservice().getvalue(\"join\")', 'null');
however, string remains un changed , can't understand why. string takes following format..
{"r":[],"c":true,"c":{"tags": [],"":3023,"s":".src.util.s@6f4e9e57","class":"class src.util.dtos.dto","type":"public","c":"m","s":0,"de fault":false,"id":544,"d":"","n":4,"na":"s","tagstring":"","pages":5},"results":[],"q":"","msg":"var s = getservice().getvalue(\"join\")
the actual string little longer hope idea abstract.
if your
var s = getservice().getvalue(\"join\")
part javascript code inside json string, need quote them again before replacing.
var r = response.replace('var s = getservice().getvalue(\\"join\\")', 'null');
Comments
Post a Comment