Results 1 to 5 of 5

Thread: Ext.Ajax.request adding extra \ (special character)

  1. #1
    Sencha Premium Member louiscooper's Avatar
    Join Date
    Mar 2012
    Location
    Austin, TX
    Posts
    30
    Answers
    1
    Vote Rating
    1
      0  

    Default Ext.Ajax.request adding extra \ (special character)

    var textFieldText = "folder\file";

    var postData = {
    'call': 'some_command',
    'param': textFieldText,
    };

    Ext.Ajax.request({
    url: "/rest/request/" + restSession,
    method: 'POST',
    params: JSON.stringify( postData ),
    headers : {
    'Authorization' : 'Basic ' + newBase64.encode(username+':'+password)
    }
    });

    The problem with this is that in the header's form data has folder\\file instead of folder\file. My guess is that it's happening somewhere within Ext.Ajax.request.

    Why the extra \ ???
    How do I avoid ext JS from adding an extra \ ?

    Thank you in advance for the help!

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Answers
    13
    Vote Rating
    10
      0  

    Default

    how eventListen_PostData its related to PostData ?
    also did you check that wasnt JSON.stringify who set that extra \ ?

  3. #3
    Sencha Premium Member louiscooper's Avatar
    Join Date
    Mar 2012
    Location
    Austin, TX
    Posts
    30
    Answers
    1
    Vote Rating
    1
      0  

    Default

    Thank you!! You are totally correct, JSON.stringify() doesn't like special characters. What's a good option for allowing special characters like blackslashes?

    params: JSON.stringify( "stuff\things" ),

    I've also tried Ext.encode(), with the same results.

    Another problem, "stuff\things" has \t, which creates a tab, which I don't want.

  4. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Answers
    13
    Vote Rating
    10
      0  

    Default

    did you try sending the string just like that ? like "stuff\things" ?
    do you get any error in the server side ?

  5. #5
    Sencha Premium Member louiscooper's Avatar
    Join Date
    Mar 2012
    Location
    Austin, TX
    Posts
    30
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I think the real problem lies when it's not a "string" but a variable pumped with text from a textfield.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •