![]() |
Error: The URI you submitted has disallowed characters - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Error: The URI you submitted has disallowed characters (/showthread.php?tid=49600) |
Error: The URI you submitted has disallowed characters - El Forum - 02-26-2012 [eluser]Krystian[/eluser] Hi, I've coded sending messege to mail address from website using post in jQuery. So, I`ve got a form and js like this: Code: var fc_name = $('#fc_name').val(); and the controller method to which I`m sending post from js Code: function send_message() and in fire bug I`m getting The URI you submitted has disallowed characters. I`m using the newest ver of CI p.s. when I run the controller method from url it sending mail without post vars of course. Error: The URI you submitted has disallowed characters - El Forum - 02-26-2012 [eluser]CroNiX[/eluser] Is your javascript you listed above in it's own file or is it a part of a php template? If it's a standalone js file, it won't be able to process your php you have in there for the base_url() and sending it as literal text. What URL does firebug say it's being sent to? Error: The URI you submitted has disallowed characters - El Forum - 02-26-2012 [eluser]Krystian[/eluser] js code is in separate js file firebug POST <?php echo base_url(); ?>main/sendmessage 400 Bad Request 943ms Error: The URI you submitted has disallowed characters - El Forum - 02-26-2012 [eluser]CroNiX[/eluser] Well, as I said, php doesn't get parsed in js files as evidenced by what you just posted (it's not interpreting the php, its posting it literally). Easiest thing to do is create a js variable in the head of your php template which all of your javascript files can then use. Code: var base_url = "<?php echo base_url(); ?>"; Then in your javascript files, just base_url + 'controller/method/etc' to create the urls. Error: The URI you submitted has disallowed characters - El Forum - 02-26-2012 [eluser]Krystian[/eluser] Thanks Cronix! or maybe create jQuery function which takes parameter. This parameter would be CI base url. again thanks |