0

I am working on an application in which i have a situation to send text data to backend through Ajax call.

But when the text "%" occurs in the text to be sent through ajax, i get the below response from my rails app

Internal Server Error 
invalid %-encoding

i tried adding escape characters infrot of % symbol, but its not useful.

Any suggestion on this issue would be helpful.


Jquery ajax call used :

enter image description here

thanks, Balan

2
  • Can you show the javascript code you are using for the ajax request? Commented Jul 31, 2012 at 9:47
  • Sure. I have updated the question with the actual jquery code used.. Commented Jul 31, 2012 at 10:03

1 Answer 1

1

You can pass jquery an object for the data option and it should correctly escape it for you:

$.ajax({
  type: "POST",
  url: "/controller",
  data: {
    text: text_from_text_area,
    current_poster: current_poster
  },
  success: function(data){
    alert(data);
  }
});

See the docs here: http://api.jquery.com/jQuery.ajax/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.