title: Send to database using ASP.NET, c# and jQuery
body: <p>New to AJAX here.
  Been trying to send to my database using AJAX but is is not working.
  In my aspx.cs: </p>
  
  <pre><code>[WebMethod]
      public static void saveMsg(string roomCode, string userName, string msg)
      {
          using (SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["LBConnectionString"].ConnectionString))
          {
              SqlCommand cmd = con.CreateCommand();
  
              cmd.CommandText = "INSERT into chatTable(roomCode, uName, msg) VALUES (" + roomCode + ", '" + userName + "', + '" + msg + "')";
              cmd.Connection = con;
              con.Open();
  
              cmd.ExecuteNonQuery();
  
              con.Close();
          }
      }
  </code></pre>
  
  <p>I am trying to insert data using AJAX and C# ASP.NET.
  This is my aspx file</p>
  
  <pre><code>$.ajax({
                      type:'POST',
                      contectType: "application/json; charset=utf-8",
                      dataType: "json",
                      url:"Room.aspx?Board='" + roomCode + "'",
                      data: "{'roomCode':'" + roomCode + "','uName':'" + userName + "','msg':'" + &lt;%=message.ClientID %&gt; + "'}",
                  })
  </code></pre>
  
  <p>The full url is <a href="http://localhost:1759/Room?Board=" rel="nofollow">http://localhost:1759/Room?Board=</a>'//roomcode'.</p>
  
  <p>Is there anything that went wrong? Like how I put the url into the AJAX function? 
  Thanks in advance!</p>
  
  <p>EDIT:
  Is it needed to put data type as JSON? New to JSON too...</p>