以下の関数は、入力文字列 (#txtarea) に含まれる文字が少ない場合は機能しますが、長い文字列が含まれている場合は機能しません。どのように機能させるのですか?
以下は私のコードです:
$('#insertcmt').click(function () {
$.getJSON('http://localhost:55679/RESTService.svc/InsertComment?callback=?', { commenttext: $('#txtarea').val() }, function (data) {
});
loadcomments();
});
サーバー側のロジック:
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public void InsertComment(string commenttext)
{
string sql = "INSERT statement";
Database db = Utilities.GetDataBase();
DbCommand cmd = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(cmd);
}
クロスドメインからアクセスしようとしているからでしょうか?