我有這樣的ajax:Ajax調用失敗時的參數包含HTML標籤
$.ajax({
url: '/PostComment/AddComment',
type: 'POST',
dataType: 'json',
cache: false,
data: { "PostId": PostId, "CommentText": CommentText },
success: function (data){
alert('Ok');
}
});
的問題是,當CommentText變量包含任何HTML標籤Ajax調用失敗。我知道這是一個奇怪的問題,但這是發生的。
向我們展示'/ PostComment/AddComment'中的內容,以及CommentText中的內容。也許你想要執行數據庫操作,並且你的數據不會被轉義/清理。 – vaso123 2014-12-02 11:36:16
你得到的錯誤代碼/消息是什麼 – 2014-12-02 11:36:49
錯誤在於ajax沒有調用任何函數 – 2014-12-02 11:52:45