Note that there are some explanatory texts on larger screens.

plurals
  1. POAppend html and keep indentation
    primarykey
    data
    text
    <p>I need to append an html string (that is a reply) using jQuery from a php call inside an iframe, but I need also to keep the indentation.<br/> Basically I send a reply to php that elaburates it and send it back through jquery that will post it, however I need to keep the markup(tabs,spaces,etc), is there a way to do it? At this moment I use this:</p> <pre><code>echo "&lt;script&gt;parent.$('#formreply').nimbleLoader('hide');parent.post_reply('".addslashes($_POST['message'])."','".$date."','".htmlspecialchars($_SESSION['name'],ENT_QUOTES,'UTF-8')."',".$json.");&lt;/script&gt;"; </code></pre> <p>But I need to remove every markeup with <code>trim(preg_replace('/\s+/','',$_POST['message']))</code>, otherwise js returns: <code>unterminated string literal</code>.<br/>This is an example of a post(the <code>eco</code>):</p> <pre><code>parent.$('#formreply').nimbleLoader('hide');parent.post_reply('&lt;pre class=\"html\"&gt; &amp;lt;script&amp;gt; alert(\'ciao\') alert(\'ciao\') &amp;lt;/script&amp;gt;&lt;/pre&gt; &lt;p&gt; &lt;/p&gt;','2013-11-01 12:29:58','Admin',null); </code></pre> <p><strong>EDIT</strong><br/></p> <pre><code>function post_reply(mess, dat, name, up) { totalmsg++; &lt;?php if(!$isMob){ ?&gt; CKEDITOR.instances.message.setData(''); &lt;?php } else { ?&gt; editor.setValue("", true); &lt;?php } ?&gt; $(".uploadfilebox").each(function () { $(this).remove() }); $(".attlist").append("&lt;div class='row-fluid uploadfilebox'&gt;&lt;/div&gt;"); tail = []; $("#messages").children(".row-fluid:first").hasClass("oddmessage") ? tail.push('&lt;div class="row-fluid evenmessage" style="display:none"&gt;&lt;div class="row-fluid"&gt;&lt;div class="span2 usrinfo"&gt;&lt;p class="username"&gt;' + name + '&lt;/p&gt;&lt;p class="date"&gt;' + dat + '&lt;/p&gt;&lt;p class="postnumber"&gt;Post Number: '+totalmsg+'&lt;/p&gt;&lt;/div&gt;&lt;div class="span8 messagecell"&gt;' + mess + "&lt;/div&gt;&lt;/div&gt;") : tail.push('&lt;div class="row-fluid oddmessage" style="display:none"&gt;&lt;div class="row-fluid"&gt;&lt;div class="span2 usrinfo"&gt;&lt;p class="username"&gt;' + name + '&lt;/p&gt;&lt;p class="date"&gt;' + dat + '&lt;/p&gt;&lt;p class="postnumber"&gt;Post Number: '+totalmsg+'&lt;/p&gt;&lt;/div&gt;&lt;div class="span8 messagecell"&gt;' + mess + "&lt;/div&gt;&lt;/div&gt;"); if (null != up){ tail.push('&lt;div class="row attachment"&gt;&lt;div class="span2 offset1 attachmentsec"&gt;Attachment&lt;/div&gt;&lt;div class="span8"&gt;'); var count= up.length; for (i=0; i &lt; count; i++) tail.push("&lt;form class='download_form' method='POST' action='../php/function.php' target='hidden_upload' enctype='multipart/form-data'&gt;&lt;input type='hidden' name='ticket_id' value='" + up[i][0] + "'/&gt;&lt;input type='hidden' name='file_download' value='" + up[i][1] + "'/&gt;&lt;input type='submit' class='btn btn-link download' value='" + up[i][2] + "'&gt; &amp;nbsp;&amp;nbsp; &lt;i class='icon-remove-sign remfile' title='Delete File' alt='Delete File'&gt;&lt;/i&gt;&lt;/form&gt;"); tail.push("&lt;/div&gt;&lt;/div&gt;"); } tail.push("&lt;/div&gt;"); $(".newest").remove(); $("#messages").children(".row-fluid:first").before(tail.join("")); $("#messages").children(".row-fluid:first").delay(300).show('scale'); $('#fielduploadinput').wrap('&lt;form&gt;').closest('form').get(0).reset(); $('#fielduploadinput').unwrap(); add++; writing=false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload