4

I have a print button and when it is clicked the following JavaScript function must be triggered.

$('.print').click(function(){
    var htmlval=$('.pop_reciept').html();
    window.open('http://localhost/ccccccc/xxxxxxx/pdf/'+htmlval,'_blank');                                  
});

htmlval contains the HTML of elements with the class pop_reciept, and then I pass this to the pdf controller:

public function pdf($val){
   echo $val;

   return false;

}

I want the HTML content need to displayed. But it is not, and instead I see the error

The URI you submitted has disallowed characters.

Please help or suggest a better way to do this.

Day
  • 9,465
  • 6
  • 57
  • 93
Anudeep GI
  • 931
  • 3
  • 14
  • 45

2 Answers2

2

The size of url is limited to 8kb at most servers, great chunks of html code can easily exceed it.
Sending a POST request instead solves the problem of disallowed characters too.
You can find a solution for this here: Window.open and pass parameters by post method

Community
  • 1
  • 1
VuesomeDev
  • 4,095
  • 2
  • 34
  • 44
0

add the special characters to variable $config['permitted_uri_chars']

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_=+-'; 

in your config.php

crynaldo madrid
  • 638
  • 2
  • 7
  • 16