Je ne comprends pas pourquoi mon script AJAX ignore tous les plis de lignes. Je tape d'abord le texte dans la zone de texte, puis je clique sur le bouton envoyer. Voici ma réalisation AJAX:PHP: Ajax ignore les plis de lignes dans le texte
// creating ajax object
// ====================
function createRequestObject(){
try { return new XMLHttpRequest() }
catch(e)
{
try { return new ActiveXObject('Msxml2.XMLHTTP') }
catch(e)
{
try { return new ActiveXObject('Microsoft.XMLHTTP') }
catch(e) { return null; }
}
}
}
// message options (save, cancel)
// ==============================
function form1(text){
var http = createRequestObject();
if(http){
http.open("GET", "my_script.php?text=" + text);
http.onreadystatechange = function(){
if(http.readyState == 4){
alert("Ok!");
}
}
http.send(null);
} else {
document.location = "my_script.php?text=" + text;
}
}
forme html
<p align="justify" style="margin-right:10; margin-left:10;">
<table style="margin-right:10; margin-left:10;" align="center" border="0" cellpadding="0" cellspacing="0" width="680">
<TBODY>
<form name="fgform">
<tr>
<td width="680" height="100" colspan="2"><p><textarea id="edit_text1" name="edit_text" rows="3" style="width: 680; height: 100;"></textarea></p></td>
</tr>
<tr>
<td width="340"><p><input type="button" id="saveB" value="Save Text" style="color:rgb(0,204,0); background-color:white; border-width:1; border-color:rgb(225,218,202); border-style:solid; width:100;" onclick="form1(document.getElementById('edit_text1').value);"></p></td>
<td width="340"><p align="right"> </p></td>
</tr>
</form>
</TBODY>
</table>
Toute suggestion d'autre de résoudre ce problème? – ilnur777