jQuery의 $ .ajax() 메소드를 통해 html을 보내려고하고 html을 새로운 .html 파일로 덤프하려고하지만 컨텐츠가 왠지 잘려나 가고 있습니다.jQuery ajax를 통해 전송 된 컨텐츠가 잘림되지 않습니다.
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script >
$(document).ready(function(){
var contents = $('html').html();
var filename = "test/000.html";
$.ajax({
type: "POST",
url: "/file.php",
data: "content="+contents+"&fn="+filename,
dataType: "html",
success: function(msg, ts, xh){
console.log(msg);
console.log(ts);
console.log(xh);
alert("success");
},
processData: false,
error: function(X, textStatus, error){
alert("Error saving... please try again now.")
}
});
});
</script>
</head>
<body>
<div id="rteContainer" class="dev">
<div id="textEditor">
<form>
<textarea name="balh" id="balh" rows="25" cols="103"></textarea>
<input type="button" id="updateContent" value="Update Changes">
<input type="button" id="closeEditor" value="Close Without Saving">
</form>
</div>
</div>
</body>
</html>
file.php 파일은 다음과 같습니다 :
<?php
header("Content-type:text/html;charset:UTF-8");
$content = "<html>".stripslashes(urldecode($_POST["content"]))."</html>";
$dump_file = $_POST["fn"];
$fp = fopen($dump_file, 'w');
fclose($fp);
echo $content;
?>
왜 끊어지고있다
나는 테스트 케이스를 설정? 문제가 인코딩 된 것 같아요,하지만이 알아낼 수 없습니다.
당신이 받고있는 응답의 예와 그 부분이 잘릴 수 있습니까? –