Solved

Do I need to serialize or sanitize data sent using jQuery's post function?

Posted on 2012-03-21
1
550 Views
Last Modified: 2012-03-24
Do I need to serialize or sanitize data sent using jQuery's post function?

var name = "abc "xyz"? 1&2&3,555";
var contact = "abc "xyz"? 1&2&3,555";

 $.post('save.php', { filename: name, content: html },
  function(data) {
    alert(data);
  }, 
  'text'
 );

Open in new window

0
Comment
Question by:hankknight
1 Comment
 
LVL 7

Accepted Solution

by:
Lalit Chandra earned 500 total points
ID: 37748447
If you want to send the JSON data to the server and aspecting the same from there ,then you have to do this.
in the $.ajax method, in the last argument you can specify  "json" ,which causes the jquery to fetch the result and deserilize automatically for you before it handles the data in the OnSuccess function of the ajax call.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now