Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Jquery, ajax php and....\n
Hi,
I’m upgrading mck_snippet form and I use a ajax request.
I grab value of textarea an send it in an object with ajax at php function.
Then it parse with Textile the value (but the problem don’t change though I leave untouch text) and save it on DB.
After I reply at ajax with textile result!
Original:
*This is an example*
This is a new line of text
Parsed and saved on DB:
<p><strong>This is an example</strong><br/>
This is a new line of text</p>
JS output:
<p><strong>This is an example</strong><br/>\n
This is a new line of text</p>
with *\n*after <br/>.
I can’t remove \n
This is the ajax script where $obj contains some value and self is the DIV that contain textarea and then as I replace with text.
$obj.html=$self.find('textarea').val();
$.ajax({
async:false,
type: "POST",
url: "parse.php",
data: {'ajaxobj':$obj},
success: function(data){ $self.value=data; },
error: function(){ $self.value='Save error'; }
});
$self.html($self.value);
Any Ideas?
Offline
Re: Jquery, ajax php and....\n
Solved:
I use textile call for value $valuedb=doSlash($textile->TextileThis($incoming['snipBody']));
of db, and for value for ajax call $valuedb=doSlash($textile->TextileThis($incoming['snipBody']));
without doSlash();
Offline
Re: Jquery, ajax php and....\n
I have noticed in page templates and forms, if you put code on a line directly underneath, not skipping an empty line but just carrage return to the next line directly, in the output HTML is a blank line space, where if you don’t indent your form code it outputs correctly without any blank lines.. Also something to do with \n I’m sure.. Minor annoyance, glad you got your code sorted!
…………………
I <3 txp
…………………
Offline
Pages: 1