Error when insert data to SQL Server using jquery in Asp.net
<p>My code : </p>

<p><code>Test.aspx</code> file:</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;Untitled Page&lt;/title&gt;
    &lt;script type="text/javascript" language="javascript" src="Scripts/jquery.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
        $(document).ready(function () {
            $('#btn_save').click(function () {
                $.ajax({
                    type: "POST",
                    url: "JqueryFunction.aspx/insert_remark",
                    data: "{remark:'" + $("#remark").val() + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function () {
                        alert("success");
                    },
                    error: function () {
                        alert("Can not insert");
                    }
                });
            });    
        });     
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form2" runat="server"&gt;
        &lt;div style="width:60px;"&gt;Remark&lt;/div&gt;
        &lt;asp:TextBox ID="remark" runat="server" TextMode="MultiLine" Height="50px" Width="295px"&gt;&lt;/asp:TextBox&gt;
        &lt;button id='btn_save' type="button"&gt;Save&lt;/button&gt;                        
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>*Code in <code>JqueryFunction.aspx</code> file:</p>

<pre><code>//Insert remark
    [System.Web.Services.WebMethod]
    public static void insert_remark(string remark)
    {

        string str_insert = "INSERT INTO remark VALUES(@remark)";

            SqlParameter[] parameter = {
                new SqlParameter("@remark", remark),
            };
            int abc = DBclass.TruyVan_XuLy_VoiThamSo(str_insert, parameter);
    }
</code></pre>

<p>If I enter in remark textbox: "I can not insert to database" my code works good. But when I enter: "I can't insert to database", I get this error:</p>

<blockquote>
<pre><code>{"Message":"Invalid object passed in, \u0027:\u0027 or \u0027}\u0027 expected. (16): {remark:\u0027I can\u0027t insert to
</code></pre>
  
  <p>database\u0027}","StackTrace":"   at
  System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32
  depth)\r\n   at
  System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32
  depth)\r\n   at
  System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String
  input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at
  System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer
  serializer, String input, Type type, Int32 depthLimit)\r\n   at
  System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String
  input)\r\n   at
  System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext
  context, JavaScriptSerializer serializer)\r\n   at
  System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData
  methodData, HttpContext context)\r\n   at
  System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
  context, WebServiceMethodData
  methodData)","ExceptionType":"System.ArgumentException"}</p>
</blockquote>

<p>How can I resolve this error when the content of text box has a <code>'</code> character</p>
