Hi, please help me out with this. I cannot send CKEditor html to server side using AJAX post. Here is my code in JQuery:
var ckBody = $("#cke_contents_ctl00_ContentPlaceHolder1_desc iframe").contents().find("body");
var ckData = ckBody.html();
$.post("admin_ajax/ajax_room_add_edit.aspx",
{
room_id: $("#subHiddenId").val(),
hotel_id: $("#ctl00_ContentPlaceHolder1_hiddenId").val(),
roomType_id: $("#ctl00_ContentPlaceHolder1_ddlRoomType option:selected").val(),
roomSize: $.trim($("#tbxRoomSize").val()),
roomPrice: $.trim($("#tbxRoomPrice").val()),
numOfBed: $("#ddlNumOfBed option:selected").val(),
maxCapacity: $("#tbxMaxCapacity").val(),
imgPath: $("#hiddenImgPath").val(),
hasFile: $("#hasFile").val(),
roomDesc: ckData
},
function (data) {
alert("come here");
//inform the result
$("#lblResult").html($.trim(data));
//reload the page
setTimeout(function () {
location.href = 'Rooms.aspx?id=' + $("#ctl00_ContentPlaceHolder1_hiddenId").val();
clearInput();
}, 1000);
}
);
The problem is when I comment \\roomDesc: ckData, it will jump to ( admin_ajax/ajax_room_add_edit.aspx) and alert("come here"). However, when I uncomment roomDesc: ckData, it cannot reach ( admin_ajax/ajax_room_add_edit.aspx) and cannot alert("come here").
Can anyone give me a hint? Thank u so much!
var ckBody = $("#cke_contents_ctl00_ContentPlaceHolder1_desc iframe").contents().find("body");
var ckData = ckBody.html();
$.post("admin_ajax/ajax_room_add_edit.aspx",
{
room_id: $("#subHiddenId").val(),
hotel_id: $("#ctl00_ContentPlaceHolder1_hiddenId").val(),
roomType_id: $("#ctl00_ContentPlaceHolder1_ddlRoomType option:selected").val(),
roomSize: $.trim($("#tbxRoomSize").val()),
roomPrice: $.trim($("#tbxRoomPrice").val()),
numOfBed: $("#ddlNumOfBed option:selected").val(),
maxCapacity: $("#tbxMaxCapacity").val(),
imgPath: $("#hiddenImgPath").val(),
hasFile: $("#hasFile").val(),
roomDesc: ckData
},
function (data) {
alert("come here");
//inform the result
$("#lblResult").html($.trim(data));
//reload the page
setTimeout(function () {
location.href = 'Rooms.aspx?id=' + $("#ctl00_ContentPlaceHolder1_hiddenId").val();
clearInput();
}, 1000);
}
);
The problem is when I comment \\roomDesc: ckData, it will jump to ( admin_ajax/ajax_room_add_edit.aspx) and alert("come here"). However, when I uncomment roomDesc: ckData, it cannot reach ( admin_ajax/ajax_room_add_edit.aspx) and cannot alert("come here").
Can anyone give me a hint? Thank u so much!