Getting a really strange error with Ajax not sending the entire string data across to the php script.
The string is
"<p class="MsoNormal" style="text-align:justify"><b><u><span lang="DE" style="font-size:10.0pt;mso-bidi-font-size:11.0pt;
font-family:"Verdana",sans-serif;mso-ansi-language:DE">Gold GoldGold Gold Gold Gold<o:p></o:p></span></u></b></p>
<p class="MsoNormal" style="text-align:justify"><span lang="EN-GB" style="font-size:10.0pt;mso-bidi-font-size:11.0pt;font-family:"Verdana",sans-serif"> </span></p>"
but what arrives at the php script is only (Seen through DB submission and the php $result test.
"<p class="MsoNormal" style="text-align:justify"><b><u><span lang="DE" style="font-size:10.0pt;mso-bidi-font-size:11.0pt;
font-family:"
I have tried to check through multiple methods of why this is happening but just cant figure it out at all.
Here is my Javascript code and php code.
JS:
function Send_upload_news()
{
get_title = document.getElementById('Germ_title');
get_date = document.getElementById('Germ_date');
input_title = get_title.value;
input_date = get_date.value;
input_content = $("div.nicEdit-main").html();
//console.log(input_content);
var Data = '&input_title='+input_title+'&input_date='+input_date+'&input_content='+input_content;
//console.log(Data);
$.ajax({
url : "uploadNews.php",
type: "POST",
dataType: 'text',
data : Data,
success: function(result){alert(result);},
/* success: function() {
alert('Post has been uploaded to Database');
}, */
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('There is an error, screenshot this error and send to Admin : ' +textStatus+" - "+errorThrown);
}
});
nicEditors.findEditor( "Germ_content" ).setContent( '' );
get_title.value = "";
get_date.value = "";
$('html, body').animate({ scrollTop: 0 }, 'slow');
};
pHp:(uploadNews.php)
<?php
//Database info
$db_host = "localhost";
$db_username = "";
$db_pass = "";
$db_name = "";
//connect db
$connMS = new mysqli ( $db_host, $db_username, $db_pass, $db_name );
//grab data
$this_title = $_POST['input_title'];
$this_date = $_POST['input_date'];
$this_content = $_POST['input_content'];
$result = file_put_contents ( "test.txt", $this_content);
//create query and execute
$sqlupdate_news = "INSERT into news_content(germ_title, germ_date, germ_content) values ('$this_title','$this_date','$this_content')";
mysqli_query ($connMS,$sqlupdate_news);
//close
mysqli_close($connMS);
?>
Im using WYSWYG Nicedit as my text area
If there is somebody that can help me figure this out I would be very grateful.