How can I add a new line within JavaScript? I've tried to use \n
and \r\n
, but nothing happened. This is a portion of the code:
var dbFile = "";
dbFile += "<"+"?"+"php\r\n\r\n<br/>";
dbFile += "class DataBaseConnection {\r\n\r\n";
dbFile += "\tprotected static $db;\r\n";
this is my code PHP for creating a file
function createFiles($folderName, $fileName, $content){
$ourFileName = $folderName."/".$fileName;
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle, $content);
fclose($ourFileHandle);
}
and I pass the content through ajax
` tag. – Derek Aug 28 '14 at 14:23
` or place the original text in a ` – canon Aug 28 '14 at 14:26