Problems with +/& characters when sending ajax requests.

Problems with +/& characters when sending ajax requests.

Hi All,

I am trying to build a PDF printing solution for my site, currently I have a small icon that a user clicks to print a pdf, then jquery reads the <DIV> content html and send it to PHP via ajax, but I have these problems:

  1. + characters are dropped.
  2. & character breaks the content that is being sent via ajax, it seems like as soon as jquery finds the & character, it tries to split that into another parameter.

Any ideas on how to resolve this?

I have tried to get the content like this:

  1. var content = JSON.stringify($(".ui-widget-content").html());
then on the php side get it like this:
  1. json_decode($_POST["print_data"])
But the & character still causes problems.