CodeIgniter Forums
Jquery Validation URL Problem - 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: Jquery Validation URL Problem (/showthread.php?tid=12043)



Jquery Validation URL Problem - El Forum - 10-03-2008

[eluser]hykoh[/eluser]
Hello,

i got a problem with my jQuery Validation URL ... it always try to send:

Code:
GET http://www.example.com/registration/ajaxControl/?username=test 190ms

It responds (cauz the GET Query Request):

Code:
The URI you submitted has disallowed characters.

I've looked in the jquery.validate.js to locate the URL building function, but without results.

Is there any way for CI to rewrite the URLs to segments like

Code:
registration/ajaxControl/username/test

Thanks for your help


Jquery Validation URL Problem - El Forum - 10-03-2008

[eluser]Nick Husher[/eluser]
Not knowing that much about jQuery, would it be possible to pass it by POST instead of GET?


Jquery Validation URL Problem - El Forum - 10-03-2008

[eluser]Pascal Kriete[/eluser]
Nick is on the ball, as usual.
In the 'remote' function there is a call to $.ajax . I don't have the source in front of me, but what you need to do is add the type parameter:
Code:
$.ajax({
    url: something,
    type: 'POST', //add this
  // ....
});



Jquery Validation URL Problem - El Forum - 10-03-2008

[eluser]Nick Husher[/eluser]
Just to be really clear, GET query strings in CodeIgniter are disallowed by default. Characters in your disallowed url characters list (in config or routes.php, IIRC) will trigger the error message you're getting. As an alternative to using POST, you can take a look at enabling query strings and enabling some creative routing:

http://ellislab.com/codeigniter/user-guide/general/urls.html