Hello All, I am trying to clean an Ajax JSON response of some invalid characters. Basically, I make an Ajax call using POST, and dataType is json. One of the variables in the JSON is a path, which contains backslashes. I also have a variable called notes which contains lots of text and line breaks, but I don't foresee that as being the issue. The problem seems to cause the success function to fail and not run. What I attempted to do is clean the response string using dataFilter, but this does not seem to work either. Anybody have any suggestions as to a way to clean this response efficiently?
Thanks, Eli Perelman Here is the request: //////////////////////////////////////////////////// $.ajax({ async: false, type: "POST", url: ajaxHandler, dataType: "json", data: "action=getInsuranceCompany&id=" + id, dataFilter: function(data,type) { data.replace(/\\/g,'\\\\'); return data; }, success: function(InsCoReturn){ objInsuranceCompany = InsCoReturn.detail[0]; } }); /////////////////////////////////////////////////////// Here is an example response: /////////////////////////////////////////////////////////// { "detail" : [{"id" : "1","useraccount" : "Alisa","datestamp" : "2008-11-28 00:00:00","companyname" : "Allianz Life Insurance Company","officephone" : "8779744653","officephoneext" : "","officefax" : "7635826004","address1" : "5701 Golden Hills Dr.","address2" : "","city" : "Minneapolis","state" : "MN","zipcode" : "554161297","contactperson" : "","contactemail" : "","contactcellph" : "","webaddress" : "","notes" : "","path" : "r:\images\horizontal \allianz.gif","verticalpath" : "r:\images\vertical \allianz_vert.gif","accountid" : "1"}]} ///////////////////////////////////////////////////////////