Friday 15 March 2013

javascript - encodeURIComponent() doesn't seem to encode '+' characters with dojo.xhrPost() -


I am trying to encode a URL that is being sent as a parameter in the POST request in the URL, + 'Characters and JavaScript encoder mononauts () do not encode them. Any idea why this issue can be?

Code:

  var url = "http: // ........" url + = "& Url =" + EncoderIcompment ( Params.url); Var deferred = dojo.xhrPost ({url: url, headers: {"with X-requested": blank), sync: correct, load: function (responsive object, ioArgs) {console.info ("...... ............... "); Parameters.On (success;);}, Error: function (error) {console.error ("Error uploading image" + error); Params.com (error));}});   

Original URL:

  http: //......../images/I/41zMWkv3+9L._CLa | 500,500 | 41c4imMJhOL .jpg, 31PAFct + UsL.jpg_.jpg   

Encoded URL:

  http: //......../images/ I / 41zMWkv3+9L._CLa%7C500,500%7C41c4imMJhOL.jpg,31PAFct+UsL.jpg_.jpg   

'|' The letters were being encoded, but not '+'.

This URL is decoded on the server side (replaced with '' by ''):

  http: // ... ..... / images / I / 41zMWkv3 9L._CLa | 500,500 | 41c4imMJhOL.jpg, 31PAFct UsL.jpg_.jpg   

I would appreciate any help with this.

Thanks

In addition to this, Worked with query string using + or encodeurIComponent or decodeurIComponent () for inverse ''

I had to replace ("", "+"); .

I say that this is normal because use this site to refer to it even more when decoding this site with + + % 2B and with / code>

or decodeurIComponent () , but you do not want

You can URLs work var url = document.location.search; .html

Repeat inside variable:

  returns the query portion of the search URL   

Example:

  http: // localhost: 8100 / index2? Json_data = Demo_title + 24+ demo + title +% 23 + proc1_script% 24 +   

with document.location.search :

 ? Json_data = demo_title% 24+ demo + title +% 23 + proc1_script% 24 +   

work with after change or other Method You can change the url of the site

  document.location.href = "index2" + url;   

Index 2 You can change with index.html or exercise.html (you have to know)

You

UPDATE

Try this code with:

  var Url = "http: // ... ..... "url + =" & url = "+ encoder component (params.url); // There is an error because '`` `` again `? Url = "` can change? Var xhrArgs = {url: url, header: {"with X-requested": blank), sync: correct, load: function (response object, ioArgs) {console.info (". ......... ........... "); params.onSuccess ();}, Error: function (error) {console.error (" Error uploading image "+ Error); params.onError ();}});   

and parameter ?

No comments:

Post a Comment