Ibid Athoillah Ibid Athoillah - 1 year ago 64
Ajax Question

how to post text '&nsbp ' using javascript?

The content that i want to send

<div id="preview">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</div>

Element function:

function _(obj) {
return document.getElementById(obj);


type: 'POST',
url: 'http://<?php echo $domain ?>/libraries/ajax/pdf.php',
data: 'html=' + _("preview").innerHTML + '&nama=a',
dataType: 'html',
beforeSend: function() {},
success: function(response) {
Materialize.toast((response), 4000);

How to send
as text instead of

Answer Source

Use the encodeURIComponent(<string to be encoded>) to encode the data

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download