php - Use JavaScript to stripslashes ? possible -


I am using Ajax to capture a URL. The problem is that the URL has a slash in it and when the JQuery load takes place then this page will not load.

AJAX Success Bit:

  Success: Function (Data) {$ ('# OPTcontentpanel'). Load (data. OPTermalink);   

PHP

  echo json_encode (array ('OPTpermalink' => $ OPTermalink,));   

and response

  http: \ / \ / www.divethegap.com \ / update \ / options \ / padi-open-water \ / < / Code>  

Then there is a need to strip the slash I know how to do it in PHP but AJAX is not in javascript

Any thoughts?

Wonderful

New answer to an old question:

  String.prototype.stripSlashes = function () {return.replace (/\\(.)/mg, "$ 1"); }   

Usage examples:

  var str = "you \ 'have been redone \ / \\ .. \ / \\"; // text from server str = str.stripSlashes ();   

Output:

  you have decreased ... / \    

Comments