Error: The URI you submitted has disallowed characters |
[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.
[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?
[eluser]Krystian[/eluser]
js code is in separate js file firebug POST <?php echo base_url(); ?>main/sendmessage 400 Bad Request 943ms
[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.
[eluser]Krystian[/eluser]
Thanks Cronix! or maybe create jQuery function which takes parameter. This parameter would be CI base url. again thanks |
Welcome Guest, Not a member yet? Register Sign In |