4

Possible Duplicate:
jQuery: How to stop AJAX function escaping JSON string used to POST data

I make a jQUERY ajax call to send and save to data.When I send Google's Dog string, I receive Google\'s Dog . What is the reason of this . And what is the best way yo avoid this. I do not want to use stripslashes function because this removes all backslashes

$.ajax({
  type: "POST",
  url: 'http://example.com/api/save',
  data: {
    data: userArray,
  },
  dataType: 'json',
  success: function(response) {
  }
});

userArray is an array which has user's information

Mickael Lherminez
  • 679
  • 1
  • 10
  • 29
Oguz Bilgic
  • 3,392
  • 5
  • 36
  • 59

2 Answers2

3

Those slashes are escaping the special characters. Basically its telling javascript to treat that character as a normal string character instead of something 'special'. Click the link for more examples.

HurnsMobile
  • 4,341
  • 3
  • 27
  • 39
0

Already answered. jQuery: How to stop AJAX function escaping JSON string used to POST data

Community
  • 1
  • 1
Capt Otis
  • 1,250
  • 1
  • 12
  • 18
  • What is the answer ?.If my question is already answered please comment it. Do not write link as a answer. – Oguz Bilgic Jul 14 '10 at 20:19
  • You now have 2 posts with the answer in a link, Capt Otis gave you a perfectly good answer, and I am frustrated by your response. – Matt Evanoff Jul 14 '10 at 20:24
  • 1
    Please use comments on the question to indicate duplicates, not answers. –  Jul 16 '10 at 04:48