0
폴더를 만들고 삭제하는 클래스를 만들고 있습니다. 아직 작업해야하는 다른 것들이 있습니다. 나는 아약스를 통해 이것을하고있다. 그리고 그것은 잘 작동합니다. 하지만 콘솔에서 같은 메시지가 두 번 나옵니다.Firebug Double console.log 메시지
왜 그럴까요? 내가 뭔가 잘못하고 있는거야? 여기
은 ( http://snippi.com/s/3sfsfvm에서도 구할 수)까지 지금 내 코드입니다 : 는<?php
//process.php
if(!empty($_POST['foldddername'])) {
require_once 'test.php';
$folder = new folder;
$path = dirname(__FILE__);
$foldername = strip_tags($_POST['foldddername']);
// $folder ->crtFolder($foldername,$path);
if($message = $folder ->crtFolder($foldername,$path)) {
echo $message;
}
}
?>
<?php
//test.php
class folder
{
public function crtFolder($foldername,$path){
$dirpath = $path."\\".$foldername;
if ((!is_dir($dirpath))) {
if(mkdir($dirpath,0777,true)) {
$error = false;
$message['error'] = false;
$message['message'] = "Folder Created";
return json_encode($message);
}
else {
$error = true;
$message['error'] = true;
$message['message'] = "Folder Failed To Create";
return json_encode($message);
}
}
else {
$error = true;
$message['error'] = true;
$message['message'] = "Folder Already Exists";
return json_encode($message);
}
}
}
?>
//Ajax handling
$(function(){
$('.submittt').click(function(){
if($('input.folder-name').val() == "")
{
console.log('Please enter Folder Name');
return false;
}
else
{
$.ajax
({
type: 'POST',
url: 'process.php',
dataType: 'json',
data:
{
foldddername: $('input.folder-name').val()
},
success:function(data)
{
console.log(data.message);
if(data.error === true)
{
console.log(data.message);
}
else
{
console.log(data.message);
}
},
error:function(XMLHttpRequest,textStatus,errorThrown)
{
console.log(data.message);
}
});
return false;
}
});
});
를, 만약 당신이 천국 ' t는 그것이 단지 나의 것이었다라고 나에게 이야기했다 나는 그것이 더 큰 다른 약간의 문제 다라고 생각했을 것이다 Thank you : – Roland