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.

2
  • I'd believe the input class automatically filters the input. Not sure what'd be the best solution around that. Commented Nov 9, 2012 at 10:35
  • 2
    Try htmlval = encodeURIComponent(htmlval); Commented Nov 9, 2012 at 10:38

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

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

in your config.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.